Re: GD functions don't delete temporary files
| From: | Matthew Weier O'Phinney | Date: | Mon, 13 Dec 2004 16:16:44 +0000 |
| Subject: | Re: GD functions don't delete temporary files | ||
| References: | 1 2 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-204188@lists.php.net to get a copy of this message | ||
* Martin Holm <martin.holm@drutt.com>:
> Steve wrote:
> > I am using GD image function with PHP (PHP 4.3.9 on RedHat 9). Today I
> > found that for all images I have created so far (using the ImageGIF()
> > function), there is a temporary file in /tmp with that image. The name
> > of the temp file is a 6 character combination of letters and digits,
> > e.g. "jvc5Ne".
> >
> > To be sure it's not a config problem, I compiled again with minumum
> > options and minimum script
> >
> > ./configure --with-gd --with-zlib
> >
> > <?php
> > $im = ImageCreate(20, 20);
> > ImageGIF($im);
> > ImageDestroy($im);
> > ?>
> >
> > But the problem is still there (CGI and CLI sapi tested). I used the
> > "-n" option, so php.ini can't cause the problem, either.
> > Has anyone else experienced that?
> >
> http://www.php.net/manual/en/function.imagegif.php ->
>
> *Note: * Since all GIF support was removed from the GD library in
> version 1.6, this function is not available if you are using that
> version of the GD library.
Umm... did you read the OP? He's not asking about GIF support -- he's
asking why temporary files created by PHP + GD are not being deleted
when imagedestroy() is issued.
To the OP: from the manual, imagedestroy merely frees memory associated
with an image resource; it doesn't remove the temp file associated with
it. It's possible that PHP is either relying on the OS's /tmp cleanup
routines or Apache's temp file cleanup, or has set a large garbage
collection interval itself in its php.ini.
--
Matthew Weier O'Phinney | mailto:matthew@garden.org
Webmaster and IT Specialist | http://www.garden.org
National Gardening Association | http://www.kidsgardening.com
802-863-5251 x156 | http://nationalgardenmonth.org