I've got images stored in a directory structure a bit like this:
(Note: There won't always be the same number of images in a "thumb" directory as in it's neighbouring "full" one.)
So: I need to use PHP to count the total number of images in all of the "full" directories.
I'm sure I could find a way to do this by getting a list of all subdirectories of "images", then cycling through them and counting the images in each one's "full" folder. But as there are going to be thousands of directories with hundreds of images in each folder, I'm looking for the most efficient solution possible - this is going to need to be done pretty often by the site.
What's the most efficient approach here?
This would work in the situation you've outlined:
$imagecount = count(glob("images/*/full/*.jpg"));
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