I'm using the PHP GD library to "print" text in images. When the text is greater than 150 characters (more or less), it ends up leaving the image border, I was able to solve this problem with "wordwrap ()". But this creates another problem, the text is aligned to the left, and for aesthetic reasons, the text should be centralized. How can I do to centralize it?
NOTE:
-
The "alignment" I am saying is not the alignment with the "coordinates" X / Y of the image.
-
I would like a solution that does not use an external dependency (such as stil / gd-text ).