missing-score
03-17-2004, 12:46 PM
Well after reading a recent thread by ConfusedOfLife I decided to set up GD on my local server. I did everything i thought i had to do, and I cant get it to work. I copied a script from php.net to test:
<?php
header("Content-type: image/png");
$string = 'hello';
$im = imagecreatefrompng("images/button1.png");
$orange = imagecolorallocate($im, 220, 210, 60);
$px = (imagesx($im) - 7.5 * strlen($string)) / 2;
imagestring($im, 3, $px, 9, $string, $orange);
imagepng($im);
imagedestroy($im);
?>
and I get this error:
The image “http://localhost/testGD.php” cannot be displayed, because it contains errors.
I removed the header, and I get:
Fatal error: Call to undefined function: imagecreatefrompng() in c:\apache\htdocs\testgd.php on line 3
I went to www.php.net and it said that there is a bundled version of GD that comes with PHP. I enabled the extension in php.ini, and I have tried setting a full path (c:/php/extensions/php_gd2.dll) as well as just php_gd2.dll.
Does anyone have any ideas how I could get this working? Im running apache (latest version), php 4.3.4 on windows XP home.
Thanks
<?php
header("Content-type: image/png");
$string = 'hello';
$im = imagecreatefrompng("images/button1.png");
$orange = imagecolorallocate($im, 220, 210, 60);
$px = (imagesx($im) - 7.5 * strlen($string)) / 2;
imagestring($im, 3, $px, 9, $string, $orange);
imagepng($im);
imagedestroy($im);
?>
and I get this error:
The image “http://localhost/testGD.php” cannot be displayed, because it contains errors.
I removed the header, and I get:
Fatal error: Call to undefined function: imagecreatefrompng() in c:\apache\htdocs\testgd.php on line 3
I went to www.php.net and it said that there is a bundled version of GD that comes with PHP. I enabled the extension in php.ini, and I have tried setting a full path (c:/php/extensions/php_gd2.dll) as well as just php_gd2.dll.
Does anyone have any ideas how I could get this working? Im running apache (latest version), php 4.3.4 on windows XP home.
Thanks