php - Putting breaks into a text written on a image -
if write text on picture code below, code tries type text in 1 line. text overflows out of image in picture1. want write in picture2.
if there function in php enables writting in picture2 it?
if there no function that, how can writting code? can give me clue?
$text = $_post['text']; // text comes form. $im = @imagecreate(700, 350) or die("cannot initialize new gd image stream"); $background_color = imagecolorallocate($im, 0, 0, 0); $text_color = imagecolorallocate($im, 233, 14, 91); imagettftext($im, 22, 0, 5, 25, $text_color, 'fonts/coolvetica rg.ttf', propertext($text)); imagepng($im, 'image.png');
picture1:
picture2:
put in bounding box using imagettfbbox()
text wrap. there's full example on php.net:
Comments
Post a Comment