Forum Moderators: coopster

Message Too Old, No Replies

imagettftext Multiple Lines Fixed image width

Stumbling with imagettftext

         

HeadBut

4:43 pm on Aug 11, 2007 (gmt 0)

10+ Year Member



Trying to use imagettftext to draw text on an image. The width and height is fixed. I'm having trouble calculating the basepoint of the first character (x and y). The text is supplied by the user so sometimes I can do one line and sometimes as many as three lines. Someone must have done this before and have a good algorithm. Or is this the wrong function to use?

eelixduppy

12:28 am on Aug 23, 2007 (gmt 0)



Have you had any luck with this problem? If you know the width in pixels of the image that you are using, you should be able to figure out how many characters can fit across the image using something like imagefontwidth [us2.php.net](). Read the user-contributed notes to get some ideas, as well.

good luck