Results 1 to 3 of 3

Thread: random images

  1. #1
    Join Date
    Apr 2006
    Posts
    429
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Cool random images

    1) Script Title: PHP Photo Album script

    2) Script URL (on DD): Script URL

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

    sorry can't post link local web server only
    Please don't mind me. I am just posting a lot of nonsense.

  2. #2
    Join Date
    Mar 2005
    Location
    SE PA USA
    Posts
    30,495
    Thanks
    82
    Thanked 3,449 Times in 3,410 Posts
    Blog Entries
    12

    Default

    Set this variable like so:

    Code:
    //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:

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

    Show Additional Thanks: International Rescue Committee - Donate or: The Ocean Conservancy - Donate or: PayPal - Donate

  3. #3
    Join Date
    Apr 2006
    Posts
    429
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    tnx
    Please don't mind me. I am just posting a lot of nonsense.

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •