Welcome to WebmasterWorld Guest from 54.225.28.32

Forum Moderators: coopster & jatar k

Message Too Old, No Replies

imagettftext Multiple Lines Fixed image width

Stumbling with imagettftext

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

Junior Member

10+ Year Member

joined:Sept 2, 2004
posts:187
votes: 0


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?
12:28 am on Aug 23, 2007 (gmt 0)

Senior Member

WebmasterWorld Senior Member eelixduppy is a WebmasterWorld Top Contributor of All Time 10+ Year Member

joined:Nov 12, 2005
posts:5966
votes: 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