php imagepng problems

Jay Daniels drs at pointyhats.com
Sun Apr 25 04:23:46 UTC 2004


On Sat, Apr 24, 2004 at 07:24:36PM +0200, Paolo Bonavoglia wrote:
> A month ago I moved the site of my school from a Win2k server to 
> Linux-Fedora.
> 
>         The site was already hosted by Apache, PhP e MySQL and everything 
> worked fine (MySQL was for now left on a Windows server).
>         Some pages use GD graphics and the imagepng function; imagepng was 
> also used by a graphic counter I realized time ago.
>         Everything worked fine under Linux Fedora too, but a few days ago 
> the graphics crashed suddenly; in the browser (Mozilla or IE just the same) 
> you see only the red cross: image error.
>         I made some debugging and surely guilty it is the function 
> imagepng (or imagejpeg, it's just the same); strangest of all, imagepng 
> works perfectly when sending output on a file, e.g.
> 
>         imagepng($im, 'figura.png');
> 
> but crashes when sending image to the browser (stdout):
> 
>         imagepng($im);
> 
>         Until now every try to correct the problem failed. Maybe a problem 
> of writing rights?
> 
>         But why the problem arose suddenly? In the last days I only 
> changed some DNS and MySQL configuration, apparently nothing to do with 
> graphics.
>         I'm not even sure wheter it is a PhP, Apache or Linux problem.
> 
>         Any idea?
> 
> 
> 
> Regards
> 
> Paolo Bonavoglia

Since no one replied, I will attempt to help.

What has writing rights or permissions have to do with it if writing
to a file works but sending to browser breaks?

What php errors do you get?

Try this to test imagepng() assuming file foo.png...

# cat getpng.php
<?php
$im = imagecreatefrompng("foo.png");
imagepng($im);
?>

# cat test.php
<?php
echo "<img src=\"getpng.php\">\n";
?>

Now browse to test.php and see if it worked or not?  The problem could
be in another function used by xyz counter or image program.

Hum, you have probably already tried that huh;)  How did you determine
it's in the imagepng or said function?  Perhaps it's in GD?

Debug the php prog and check file permission on such image program's
directories, etc.  I think all these functions require a working GD
image lib of correct version?


jay





More information about the fedora-list mailing list