I am using file_get_contents() to pull some images from a remote server and I want to confirm if the result string is a JPG/PNG image before further processing, like saving it locally and create thumbs.

$string = file_get_contents($url);

How would you do this?

php
Edit
Report