Check if external image exists
Quick and easy PHP script to determine if image exists. The image you are checking for can be hosted on your site or externally.
This script is useful to display an alternate image if the original one does not exist.
Note: This script uses GD, so you’ll need to have GD installed on your server for it to work.
<?php
if (@GetImageSize("http://www.testdomain.com/testimage.gif")) {
echo "image exists";
} else {
echo "image does not exist";
}
?>
Use this script instead if you don’t have GD installed:
<?php
if (@fclose(@fopen("http://www.testdomain.com/testimage.gif", "r"))) {
echo "image exists";
} else {
echo "image does not exist";
} >

