rockinaway Posted February 19, 2007 Share Posted February 19, 2007 What code would I use to check if an image is present in a particular directory, and if it isn't show another image? I know there would be an IF but what else? Link to comment https://forums.phpfreaks.com/topic/39133-if-images-is-not-there/ Share on other sites More sharing options...
jaikar Posted February 19, 2007 Share Posted February 19, 2007 this may be helpfull to you $path = "Dir Name"; $file_types = array('jpeg', 'jpg', 'png', 'gif', '); $p = opendir($path); while (false !== ($filename = readdir($p))) { $files[] = $filename; } if(count($files) != 0){ echo "Image Exists"; } ~J Link to comment https://forums.phpfreaks.com/topic/39133-if-images-is-not-there/#findComment-188469 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.