#29594 [Opn]: imagegif gives warning "Unable to open temporary file "
| From: | jbrady at sbccd dot cc dot ca dot us | Date: | Mon, 16 Aug 2004 18:54:41 +0000 |
| Subject: | #29594 [Opn]: imagegif gives warning "Unable to open temporary file " | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-64724@lists.php.net to get a copy of this message | ||
ID: 29594
User updated by: jbrady at sbccd dot cc dot ca dot us
Reported By: jbrady at sbccd dot cc dot ca dot us
Status: Open
Bug Type: GD related
Operating System: Windows XP,2003
PHP Version: 5CVS-2004-08-10 (dev)
New Comment:
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;
}
Previous Comments:
------------------------------------------------------------------------
[2004-08-10 03:12:12] 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
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=29594&edit=1