[SOLVED] PHP GD library problem
Posted: Tue Oct 12, 2004 10:22 am
Hi,
I am trying to use some GD functions to create an image on the fly. However I keep getting the following error:
At first I thought that it was my dev PC (WinXP, PHP 4.3.4 which makes no mention of the GD library when using phpinfo() )
But on the Linux server running PHP 4.3.9, phpinfo() reports that GD is enabled, as are all sub options, and the version is "bundled (2.0.28 compatible)"
The code is from the tips pdf of the PHPCon2002, by Rasmus Lerdorf:
Any ideas?
I am trying to use some GD functions to create an image on the fly. However I keep getting the following error:
(zzzzzzzzzz is for illustration purposes only of course!)The image “http://www.zzzzzzzzzz.com/test2.php” cannot be displayed, because it contains errors.
At first I thought that it was my dev PC (WinXP, PHP 4.3.4 which makes no mention of the GD library when using phpinfo() )
But on the Linux server running PHP 4.3.9, phpinfo() reports that GD is enabled, as are all sub options, and the version is "bundled (2.0.28 compatible)"
The code is from the tips pdf of the PHPCon2002, by Rasmus Lerdorf:
Code: Select all
<?php
Header("Content-type: image/png");
$im = ImageCreate(630,80);
$blue = ImageColorAllocate($im,0x5B,0x69,0xA6);
$white = ImageColorAllocate($im,255,255,255);
$black = ImageColorAllocate($im,0,0,0);
ImageTTFText($im, 45, 0, 10, 57, $black, "CANDY", $text);
ImageTTFText($im, 45, 0, 6, 54, $white, "CANDY", $text);
ImagePNG($im);
?>
<IMG src="txt.php?text=<?echo urlencode($text)?>">