Author Topic: RandomImage also from subfolders  (Read 1938 times)

Offline YoJoe

  • Posts: 74
    • projektowanie stron
RandomImage also from subfolders
« on: May 27, 2011, 01:42:36 AM »
Since randomimage droplet uses a readdir() function, I'm wondering if it would be much hassle to change its algorithm to use scandir(), to also draw an image from nested directory.
The main reason is to show randomly chosen image on index page from existing image galleries.

The best way would be to scandir() for all directories in root directory, choose a random subdirectory and then choose a random img from it. Because scanning all subdirs, and loading all img files would take unnecessary time and resources only to grab, and show 1 photo.

There wouldn't be much a problem with nested dirs with images named like:
because it would be a simple change in droplet.
But nested directories are going to have random names, and that's too much for my rookie php skills :/
WuJitsu - in web I trust  :cool: