PDA

View Full Version : using graphics in php


jamal
11-10-2002, 12:42 PM
Hi Guys,
I am trying to check if GD-library is working together with PHP but it failed. I have to run the below code to check it. I have already downloaded GD-1.8.4.
Please can anyone help me on how to configure graphics with php.



header ("Content-type: image/png");
$im = @ImageCreate ( 50, 100)
or die ("Cannot create a new GD image.");
$background_color = ImageColorAllocate ($im, 255, 255, 255);
$text_color = ImageColorAllocate ($im, 233, 14, 91);
ImageString ($im, 1, 5, 5, "A Simple Text String", $text_color );
ImagePng ($im);

thanks

firepages
11-10-2002, 04:39 PM
that probably won't give you a useful error message , you need to know if GD has actually loaded or not, (I am assuming you have saved the php_gd.dll to your php extensions directory and uncommented the extension in the php.ini ?)

you can do this ...
<?phpinfo;?>
and look for the GD section in the returned tables .. is it there ?

or even


<?
if (extension_loaded('gd')){
echo "GD functions are available.<br>\n";
} else {
echo "GD functions are not available.<br>\n";
}
?>