php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #29594 imagegif gives warning "Unable to open temporary file "
Submitted: 2004-08-10 03:12 UTC Modified: 2004-08-17 01:09 UTC
Votes:2
Avg. Score:4.0 ± 1.0
Reproduced:2 of 2 (100.0%)
Same Version:2 (100.0%)
Same OS:2 (100.0%)
From: jbrady at sbccd dot cc dot ca dot us Assigned:
Status: Closed Package: GD related
PHP Version: 5CVS-2004-08-10 (dev) OS: Windows XP,2003
Private report: No CVE-ID: None
 [2004-08-10 03:12 UTC] jbrady at sbccd dot cc dot ca dot us
Description:
------------
I installed the latest version of php5 (built Aug 10 2004 02:15:17 ). I used php.ini-recommended changing only:

display_errors = on
extension_dir = "c:\php\ext"
extension=php_gd2.dll

Tried on Windows XP and Windows 2003. When I use the imagegif() function, it gives me a warning: "Warning: imagegif() [function.imagegif]: Unable to open temporary file in c:\Inetpub\wwwroot\tests\php\imagetest.php on line 6
"

It is not a permissions problem. The temporary file functions work, and if I change it to imagejpeg, it outputs the picture, without any errors.

Reproduce code:
---------------
<?php
$strFileName = "http://static.php.net/www.php.net/images/php.gif";
$image = imageCreateFromGif($strFileName);
if(is_resource($image)) {
   // NOTE:
   // Required to get a picture on Netscape
   // Comment out to get Error messages
   header("Content-type: image/gif");
   // END NOTE
   imagegif($image);
   imageDestroy($image);
   exit;
}
?>

Expected result:
----------------
The php logo from the php website.

Actual result:
--------------
Warning: imagegif() [function.imagegif]: Unable to open temporary file in c:\Inetpub\wwwroot\tests\php\imagetest.php on line 6


Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2004-08-16 20:54 UTC] jbrady at sbccd dot cc dot ca dot us
Did some testing today. The tmpname support works fine (writes to the c:\windows\temp directory just fine). I used it to create a temporary file, and used imagegif to write to it, then outputed the image, and it worked fine. It seems it just can't create the file on its own (when you omit the optional file parameter).

Code used in this test:
$strFileName = "http://static.php.net/www.php.net/images/php.gif";
$image = imageCreateFromGif($strFileName);
if(is_resource($image)) {
   $tmpfname = tempnam("","");

   // NOTE:
   // Required to get a picture on Netscape
   // Comment out to get Error messages
   header("Content-type: image/gif");
   // END NOTE

   imagegif($image,$tmpfname);
   imageDestroy($image);
   $string = file_get_contents($tmpfname);
   unlink($tmpfname);
   echo $string;
}
 [2004-08-17 01:09 UTC] iliaa@php.net
This bug has been fixed in CVS.

Snapshots of the sources are packaged every three hours; this change
will be in the next snapshot. You can grab the snapshot at
http://snaps.php.net/.
 
Thank you for the report, and for helping us make PHP better.


 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Thu Nov 21 15:01:30 2024 UTC