PDA

View Full Version : PHP Code Problem


webhost
12-08-2002, 10:52 AM
Ok fellows getting a parse error in line three below. Can someone see what I am missing. getting this error Parse error: parse error in /home/username/public_html/font/font.php on line 3


<?
Header("Content-type: image/gif");
if(!isset($s)) $s=11;
$size = imagettfbbox($s,0,"/home/username/public_html/font/fonts/verdana.TTF",$text);
$dx = abs($size[2]-$size[0]);
$dy = abs($size[5]-$size[3]);
$xpad=9;
$ypad=9;
$im = imagecreate($dx+$xpad,$dy+$ypad);
$blue = ImageColorAllocate($im, 0x2c,0x6D,0xAF);
$black = ImageColorAllocate($im, 0,0,0);
$white = ImageColorAllocate($im, 255,255,255);
ImageRectangle($im,0,0,$dx+$xpad-1,$dy+$ypad-1,$black);
ImageRectangle($im,0,0,$dx+$xpad,$dy+$ypad,$white) ;
ImageTTFText($im, $s, 0, (int)($xpad/2)+1, $dy+(int)($ypad/2), $black, "/fonts/verdana.TTF", $text);
ImageTTFText($im, $s, 0, (int)($xpad/2), $dy+(int)($ypad/2)-1, $white, "/fonts/verdana.TTF", $text);
ImageGif($im);
ImageDestroy($im);
?>

assassingod
12-08-2002, 11:03 AM
Have you got 'verdana.TTF' in the right directory?

webhost
12-08-2002, 11:06 AM
yes

webhost
12-10-2002, 09:28 AM
fixed

JulianD
12-10-2002, 11:57 AM
What was the problem? When I first saw this post I didn't found any problem on line 3 of this script.

Xenon
12-10-2002, 03:52 PM
me's intrested,too
didn't saw a problem either...

webhost
12-12-2002, 10:36 PM
got it working but had to change to this

<?
Header("Content-type: image/png");
if(!isset($s)){$s=11;}
$size = imagettfbbox($s,0,"/home/username/public_html/font/fonts/verdana.TTF",$text);
$dx = abs($size[2]-$size[0]);
$dy = abs($size[5]-$size[3]);
$xpad=9;
$ypad=9;
$im = imagecreate($dx+$xpad,$dy+$ypad);
$blue = ImageColorAllocate($im, 0x2c,0x6D,0xAF);
$black = ImageColorAllocate($im, 0,0,0);
$white = ImageColorAllocate($im, 255,255,255);
ImageRectangle($im,0,0,$dx+$xpad-1,$dy+$ypad-1,$black);
ImageRectangle($im,0,0,$dx+$xpad,$dy+$ypad,$white) ;
ImageTTFText($im, $s, 0, (int)($xpad/2)+1, $dy+(int)($ypad/2), $black, "/home/username/public_html/font/fonts/verdana.TTF", $text);
ImageTTFText($im, $s, 0, (int)($xpad/2), $dy+(int)($ypad/2)-1, $white, "/home/username/public_html/font/fonts/verdana.TTF", $text);
imagepng($im);
ImageDestroy($im);
?>