Page 1 of 1

Error with imagegif() function

PostPosted: 10. July 2005 20:10
by edwin1
Hello everyone,

I'm using the XAMPP for Linux 1.4.14, PHP 5.0.4 (although the problem I describe below also occurs with PHP 4.3.11) and Mandrake Linux 10.

Whenever I use the imagegif() function, I get the following error:

Warning: imagegif() [function.imagegif]: Unable to open temporary file in /path/to/script.php on line 6


I've seen the following bug:

http://bugs.php.net/bug.php?id=29594

This is exactly the same problem that I'm having (except I'm using Linux rather than Windows). The second bit of code posted on that page works fine, but the first one produces an error. It can't be a problem with the /tmp folder on the server because other features which require the temporary folder work (such as sessions and the second bit of code posted at the URL above).

The bug was reported back in August last year, so I don't believe it to be a problem with PHP any more. So could this be a problem with XAMPP? Perhaps somehow an updated file to fix this bug hasn't been replaced in the newest version of XAMPP? Is this a possibility?

Thanks for any help,

Edwin

PostPosted: 11. July 2005 22:13
by Oswald
Dear Edwin!

I just wrote a litte program for testing your problem:

Code: Select all
<?
        header ( "Content-Type: image/gif" );

        $im  =  ImageCreate( 100,  100 );

        $r=255;
        $g=128;
        $b=0;
        $fill  =  ImageColorAllocate ( $im ,  $r,  $g, $b );

        ImageFill ( $im , 0 , 0 , $fill );

        ImageGIF ( $im );
?>


Please try it on your installation. For me it works fine with XAMPP 1.4.13. It should return you a orange 100 x 100 px square.

Best regards
Oswald

PostPosted: 11. July 2005 23:21
by edwin1
Hi Oswald,

Thanks for replying.

I created a file with the code you posted, and the following error was produced:

<br />
<b>Warning</b>: imagegif() [<a href='function.imagegif'>function.imagegif</a>]: Unable to open temporary file in <b>/virtual/host9/htdocs/imagetest.php</b> on line <b>13</b><br />


Changing the function to imagejpeg() (as described in the bug report) produces the orange square fine. So since creating a jpeg file works, I would guess that rules out any permission problems on my server, but I'm not entirely sure.

Thanks for your help,

Edwin