I am using WordPress. I have an image folder like mytheme/images/myimages
.
I want to retrieve all the images name from the folder myimages
Please advice me, how can I get images name.
Show activity on this post. $dir = "mytheme/images/myimages"; $dh = opendir($dir); while (false !== ($filename = readdir($dh))) { $files[] = $filename; } $images=preg_grep ('/\. jpg$/i', $files);
Simply run the command from a command line window in the directory where your images are stored. If you need to have the all. html in some other place either move it there or change to >> C:\files\html\all.
try this
$directory = "mytheme/images/myimages"; $images = glob($directory . "/*.jpg"); foreach($images as $image) { echo $image; }
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With