I need to programmatically check whether the image that the user has selected as his wallpaper on my app is broken or corrupted.......
basically I provide user with the opt
If instead you are looking for a PHP solution instead of a javascript solution (which the potential duplicates do not provide), you can use GD's getimagesize() in PHP and see what it returns. It will return false and throw an error when the provided image format is not valid.