Hello, i need help to improve this script, i don't know how to break lines. When i press "Create" button, if the phrase is too long...they escape from the image. So i need: 1. break lines 2. Limit the width of phrase and automatic break lines into width of image. online: http://rflmao.info/ <form method="post"> <textarea name="user" cols="80" rows="5" class="textbox"> Text It doesn't break lines </textarea> <input type="submit" class="button" value="Create"> <input type="image" border="0" width="500" height="410" src="write.php?caption=<?php echo $_REQUEST['user'] ?>"> </form> Code (markup): And the script: <?php header("Content-type: image/jpeg"); //$user = $_POST['caption']; $user = $_GET['caption']; $im = imagecreatefromjpeg("imagem.jpg"); $user_width = imagettfbbox(9, 3, "tahoma.ttf", $user); $x_value = (250 - ($user_width[2] + 113)); $color = imagecolorallocate($im, 0, 0, 0); imagettftext($im, 25, 0, $x_value, 58, $color, "tahoma.ttf", $user); imagejpeg($im); imagedestroy($im); ?> Code (markup): Any help is welcome, i'm new in php. Thanks!
$text = "The quick brown fox jumped over the lazy dog."; $newtext = wordwrap($text, 20, "<br />\n"); echo $newtext; PHP: http://us2.php.net/manual/en/function.wordwrap.php