In PHP you can use the function file_exists() to check for the existence
of the image, and accordingly change the image name.
PHP Code:
if file_exists($imagefilename)
echo '<IMG SRC="$imagefilename" >';
else
echo '<IMG SRC="$defaultimagefilename" >';