image file already exist in the folder or not checking in php code example
Example: check image is available on server php
if (file_exists('http://www.mydomain.com/images/'.$filename)) {
… }
if (file_exists('http://www.mydomain.com/images/'.$filename)) {
… }