How can I wrap text using Imagick in PHP so that it is drawn as multiline text?
The Imagick library in PHP allows you to draw text on top of an image. How can I tell Imagick to wrap the text based upon some bounded text box, so that the words appear as multiline text rather than a single line? Usage: list($lines, $lineHeight) = wordWrapAnnotation($image, $draw, $msg, 140); for($i = 0; $i < count($lines); $i++) $image->annotateImage($draw, $xpos, $ypos + $i*$lineHeight, 0, $lines[$i]); Function: /* Implement word wrapping... Ughhh... why is this NOT done for me!!! OK... I know the algorithm sucks at efficiency, but it's for short messages, okay? Make sure to set the font