I've been using this function to check for broken images and it works for most of them but it says that some don't exist when they do display fine on my website.
For example this image shows up fine but I can't detect that it exists:
$curl = curl_init($url);
//don't fetch the actual page, you only want to check the connection is ok
curl_setopt($curl, CURLOPT_NOBODY, true);
$result = curl_exec($curl);
$ret = false;
//if request did not fail
if($result !== false)
//if request was ok, check response code
$statusCode = curl_getinfo($curl, CURLINFO_HTTP_CODE);
if ($statusCode == 200)
$ret = true;
also getimagesize() has the same problem, it can't get the size but the image displays fine.
How can I find if an image will display in the browser without checking by hand?