View Single Post
  #22 (permalink)  
Old 05-09-2007, 08:12 AM
snailofsatan snailofsatan is offline
Newbie
 
Join Date: May 2007
Posts: 4
Rep Power: 0
snailofsatan is on a distinguished road
Default

sorry to be a pain, but i'm a bit new to this GD stuff! do you know how i can implement the php word wrap into the GD code below?

Quote:
<?php
$text = "The quick brown fox jumped over the lazy dog.";
$newtext = wordwrap($text, 20, "<br />\n");

echo $newtext;
?>

Quote:
<?php
header('Content-type: image/png');
$text = $_GET['text'];

$im = imagecreatefrompng ("userbar.png");

$color = imagecolorallocate($im, 0, 0, 0);

$font = 'font.ttf';
$fontsize = 6;
$size = imagettfbbox($fontsize, 0, $font, $text); //calculate the pixel of the string
$dx = (imagesx($im)) - (abs($size[2]-$size[0])) - 20; //calculate the location to start the text
imagettftext($im, $fontsize, 0, $dx, 13, $color, $font, $text);
imagepng($im);
imagedestroy($im);
?>
thanks in advance for any help/tips!

ps if i use $newtext in the GD code, won't it ignore the <br>s and /n's and just show the code as text? or will it process them and move down to a new line?
kev

Last edited by snailofsatan; 05-09-2007 at 08:15 AM. Reason: addition
Reply With Quote