does ImageCreateFromJPEG suck up memory?
| From: | DrTebi | Date: | Sun, 28 Apr 2002 03:09:37 +0000 |
| Subject: | does ImageCreateFromJPEG suck up memory? | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-94958@lists.php.net to get a copy of this message | ||
Hi,
I was using this little check to see if an uploaded image has the correct
type:
if($img && $img_type != 'image/jpeg'){
$error['img'] = 'image has to be "jpeg"<BR>';
}
but the ImageCreateFromJPEG function in the next script returned:
Warning: imagecreatefromjpeg: '/tmp/1.jpg' is not a valid JPEG file
This seems to happen with images that are kind of corrupted or something, I
am not sure why. Anyhow, I implemented this as an error check instead:
if(!$photo = @ImageCreateFromJPEG($img)){
$error['img'] = 'image is not a valid jpeg file<BR>';
}
This works, but my question is do I have to use 'ImageDestroy' everytime
after I used the 'ImageCreateFromJPEG' function? Would now any tmp files be
clogging up the /tmp directory? Would it suck up memory?
Thanks,
DrTebi