I want to create a text image for a newsletter from a textearea. So, it would have more than 1 line. I was thinking about of using imagettfbbox to calculate the total width and height (of all lines), and then use imagettftext to write in the image. The problem is that, I noticed that the more the font-size is, the more padding left is adding "imagettftext" to the text. imagettfbbox is telling me nothing about that padding. the returing array values [0] and [1] are both ALLWAYS = -1.
Thanks!
You could do this with GD or ImageMagick, I will post a basic example using GD.
Now for formatting this string you can use strlen() to return the lengths of individual strings and propagate that to your function as needed. For a more stream-lined approach consider using ImageMagick because it supports TextAlignment and more.
I hope that this will help you. I can elaborate on any questions you might have.