I am using WordPress. I have an image folder like mytheme/images/myimages.
mytheme/images/myimages
I want to retrieve all the images name from the folder myimages<
myimages
$dir = "mytheme/images/myimages"; $dh = opendir($dir); while (false !== ($filename = readdir($dh))) { $files[] = $filename; } $images=preg_grep ('/\.jpg$/i', $files);
Very fast because you only scan the needed directory.