Looking for a stack displaying shuffle image from warehouse folder


(Paul) #1

Hi,
I have a folder with 300 to 500 pictures inside, hosted on my server.
I need to display only 1 to 6 photos on a page, but I would like them display randomly each time the page is loaded.
Do you have any idea ?

Thanks !


(Wolf Ademeit) #2

Total CMS can do that for you


(scott williams) #3

Check out photostream stack from instacks, I know it will do random. Not sure about display only one.


(Paul) #4

Thank you ! I will try photostream and ask developer if this is possible. CMS would be too expensive for this only need.


(Paul) #5

Finally, Photostream does not do the job I’m looking for, because it displays ALL the pictures in the folder.
My folder contains 350 to 500 images… impossible !

Any another idea ?


(scott williams) #6

Okay,
I put some php code in my dropbox for you (I sent you link via pm. I will leave it up there for a few days)

Put it in an html stack
Name your page .php
Change the paths - You will see comments in top of code.
Publish the page

EXAMPLE PAGE


(Paul) #7

Thanks for helping me swilliam ! I just sent you a message.


(Paul) #8

Hi,
I found this php code on a forum. Does someone know how to integrate it on a stacks page in RW ?
$imagesDir = ‘images/tips/’;

$images = glob($imagesDir . ‘*.{jpg,jpeg,png,gif}’, GLOB_BRACE);

$randomImage = $images[array_rand($images)]; // See comments

Thanks !