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



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

Reply via email to