check image is available on server php

PHP
if (file_exists('http://www.mydomain.com/images/'.$filename)) {
 … }
Source

Also in PHP: