rainborick - 3:26 pm on Jun 11, 2013 (gmt 0)
The GD graphics library does not automatically break up lines of text to fit within the image boundaries. Your script must calculate the number of pixels required by the string you want to draw (the width), where you need to break the string into lines, and the x and y coordinates of each line to be drawn.
For short strings of one or two sentences, a simple calculation is acceptable. You just need to find the width of each character in the font you're using as well as an appropriate line-height, then use explode() to break the string into words. From there you can calculate where to break up the string into separate lines, and draw them on your image.
If you want to draw long strings consisting of several sentences, I would recommend you search Google for "php gd word wrap". You'll find a few examples of how to do this.