Hi. Lets say i create an image using php, with the dimentions 250x100px. How can i then write a string onto that image, which will break into new lines, to fit onto it? Using the imagestring() function, it seems to just continue, past the edge of the image. Thanks in advance, Dan.
i think the image functions dont support this feature, but wordwrap() may be usefull for you - breaks the text to a new line after x chars.
what? you cant wordwrap() your text and then insert it into the image?! never tried it, but thats kinda lame :/
The only method I came across to insert multiple text lines into an image is using the imagestring() fuction twice or more. If anyone has another solution, feel free to share.
I would say use some function to determine how many rows there would be when the text is properly placed on the image. For example if you can put 50 characters in one line and the text has 150 characters, you'd need 3 lines. Then you set different starting positions for the situations if you have only 1 line, if you have 2 lines etc. up to whatever maximum amount of lines you'd like to use. When you have done that you simply break the text into rows and voilá.