Click to See Complete Forum and Search --> : No image output with GD
I hvd installed gd-1.8.3 , libpng-1.0.8, jpeg-6b-3, and zlib-1.1.3 on the /usr/local directory. There were no error on "make" and "make install" for gd-1.8.3, libpng and zlib programs
PHP4.0.4 configured and compiled with GD support. The phpinfo() report GD support present.
A sample PHP code to create an gif image.
<?php
header("Content-type: image/gif");
$image=imagecreate(200,200);
imagegif($image);
?>
No gif image output on the netscape 4.7's browser window when loading the above PHP code.
Did I make skip any step during the installation or configuration of the above programs?
Thank you inadvance
Puzzle
GD 1.8.3 doesn't have GIF-support unless you use a special, patched version like the one at
http://rpms.arvin.dk/gd-with_gif/
I blundered for not reading the readme notes carefully that comes with the GD files. Thank you for highlight. I intend to used PNG instead of GIF format.
So, I have change change my code to the following for creating a png image.
<?php
header ("Content-type: image/png");
$Image= Imagecreate(200,200);
Imagepng=($image);
?>
But the problem still persist, did I missed anything on the source code?
There are several problems with this sample code;
1) $Image = Imagecreate(200,200); should be
$Image = ImageCreate(200,200);
2) Imagepng=($image); should be
Imagepng ($Image);
Now this will create an image 200 X 200 with no content whatsoever.. to create some color include the following;
$background_color = ImageColorAllocate ($Image, 55, 55, 55);
So we have the revised sample code;
<?php
header ("Content-type: image/png");
$Image= ImageCreate(200,200);
$background_color = ImageColorAllocate ($Image, 255, 255, 255);
Imagepng ($Image);
?>
This script should be called from an img tag in an html page, eg. <img src="image.php">
If this does not solve your problem it may be that libgd is not properly configured or installed.
I used the above modified code and it did not solved the problem. You are absoultely right about the libgd was not properly installed. Even though the "phpinfo()" reported "GD Support Enable" but somehow it didn't output the PNG image. However I decided to revert to the older version of GD library comes with with RH6.2 (gd-1.3-6.rpm version) and problem solved but it doesn't support PNG image. I think the installation of PHP4.0.4, GD library, libjepg-6b, libpng, and zlib was incorrectly done.
Thank you all who has provided me the clues,hints and codes to solve this problems.
I am having the same problem with installing gd1.8.3 after i beleive to have removed gd1.3
I am told i have wbmp support through php-info but the only thing i can see is the alternate name
Please help
PHP Builder
Copyright WebMediaBrands Inc. All Rights Reserved.