advanced code snippet search
coggla on 01/20/08
images directory opendir
01/20/08 10:20pm
2 people have marked this snippet as a favorite
mbcdguisluu
Function to retrieve all image files in a given directory
function listImages($dirname=".") { $ext = array("jpg", "png", "jpeg", "gif"); $files = array(); if($handle = opendir($dirname)) { while(false !== ($file = readdir($handle))) for($i=0;$i<sizeof($ext);$i++) if(strstr($file, ".".$ext[$i])) $files[] = $file; closedir($handle); } return($files);}
Report this snippet Tweet
Comment:
You need to login to post a comment.