I got a generic ≥text to png on the fly≤ script which works fine but I want
to change it so that the image has the same hight and width as the text
string (so the text has no border around it) For and example of what I want
to do check out: http://www.spoono.com/font/?string=This is what i want to
do&.png
I have the script:
<?

  Header("Content-type: image/png");

  if(!isset($s)){$s=8;}

  $size = 
imagettfbbox($s,0,"/home/xelerix/public_html/font/fonts/04B_03__.TTF",$text)
;

  $dx = abs($size[2]-$size[0]);

  $dy = abs($size[5]-$size[3]);

  $xpad=9;

  $ypad=9;

  $im = imagecreate($dx+$xpad,$dy+$ypad);

  $bg = ImageColorAllocate($im, 102,102,102);

  $white = ImageColorAllocate($im, 255,255,255);

  ImageTTFText($im, $s, 0, (int)($xpad/2), $dy+(int)($ypad/2), $white,
"/home/xelerix/public_html/font/fonts/04B_03__.TTF", $text);

  imagepng($im);

  ImageDestroy($im);

?>

The text for the image is called from a url like
www.xelerix.com/font/font.php?text=Hi

Thanks!


Reply via email to