Jay Blanchard wrote:
> [snip]
>> Yes. You will have to write your own clean-up code for things like
> this.
>
> I don't mean any user generated temporary files, I mean files which are
> created by the PHP function ImageGIF(). How should I even know which
> temporary file name GD chose in each case, or whether it created a temp
> file at all in a particular case?
> [/snip]
>
> Before the image is created you can get an array of things in the temp
> file, then check for a new thing after the image is created. You can
> verify the file type and if all is kosher, delete it.

This would be a recipe for disaster.

Other programs/processes will use /tmp to create GIF files, and there is
NO WAY to can be sure the one you want is the one you delete.

In particular, if your web site gets busy, your script may well be running
in parallel, with multiple instances of GIF files in /tmp, and there is
really really NO WAY AT ALL to know which file goes with which script
process.  Actually, you could *maybe* check enough info about the file,
such as process id owner stuff, if that's recorded...  But, really, this
is just going to be way more trouble than it's worth.

Don't do this.

Re-configure your server to delete /tmp files faster or more often.

Or, see if you can get imagegif() to save the files elsewhere by passing
in a valid filename *YOU* choose (possibly still in /tmp) as an argument.

*THEN* you could safely delete the file, since you chose the name.

-- 
Like Music?
http://l-i-e.com/artists.htm

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to