When displaying images on our website, we check if the file exists with a call to file_exists(). We fall back to a dummy image if the file was missing.
file_exists()
Howe
What about glob()? But I'm not sure if it's fast.
glob()
http://www.php.net/manual/en/function.glob.php