View Full Version : random images

07-25-2006, 02:40 AM
1) Script Title: PHP Photo Album script

2) Script URL (on DD): Script URL (http://www.dynamicdrive.com/dynamicindex4/php-photoalbum.htm)

3) Describe problem: is there a way to randomize the images? :p tnx :D

sorry :( can't post link local web server only :(

07-25-2006, 03:32 AM
Set this variable like so:

//Sort images by date? ("asc", "desc", or "")
//"desc" for example causes the newest images to show up first in the gallery
//"" disables this feature, so images are sorted by file name (default)
var gsortorder="rand"

Go down a few lines and find these lines (black) and add the red ones shown to them:

if (gsortorder=="asc" || gsortorder=="desc")
else if (gsortorder=="rand")
galleryarray.sort(function() {return 0.5 - Math.random();}) //thanks to Mike (aka Mwinter) :)

07-25-2006, 03:54 AM
tnx :p