Align text within imagettfbbox () - GD

0

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 ).

asked by anonymous 04.12.2018 / 18:37

0 answers