PHP function detecting whether a jpg file is valid?

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
User avatar
wvoyance
Forum Contributor
Posts: 135
Joined: Tue Apr 17, 2012 8:24 pm

PHP function detecting whether a jpg file is valid?

Post by wvoyance »

Is there any function in PHP that can detect whether a jpg picture is valid or not?
User avatar
requinix
Spammer :|
Posts: 6617
Joined: Wed Oct 15, 2008 2:35 am
Location: WA, USA

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

Post 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).
Post Reply