Page 1 of 1

PHP function detecting whether a jpg file is valid?

Posted: Sun Jun 24, 2012 9:55 pm
by wvoyance
Is there any function in PHP that can detect whether a jpg picture is valid or not?

Re: PHP function detecting whether a jpg file is valid?

Posted: Sun Jun 24, 2012 10:15 pm
by requinix
If all you care is that it looks valid then getimagesize tell you that. If you actually want to validate the entire thing then you'll have to load it into memory with something like imagecreatefromjpg (and don't forget to unload it).