random image from album

hi there,

i've been reading around these forums and i can't seem to find what i want so i'll just ask. Is there a plugin or a bit of code that someone is willing to share that i could add to the page that puts a thumbnail of a random image from an album and links too it if someone wants to click on it?

Comments

  • gjr Member
    http://www.zenphoto.org/documentation/functions/_template-functions.php.html#functionprintRandomImages

    You will see in the doc of that link how to pull from a specific album.

    So for example, if I want to get 3 random images from the album (folder name=vacation) vacation:

    `

    printRandomImages(3,null,'album','vacation')

    `
  • thanks for the info mate! i'm still having a little bit of trouble making this work... sorry in advance if the question is stupid but i'm still fumbling my way through this.

    now what Im trying to do it edit the image.php file of the template i'm using and just make a smaller "thumbmail" size random image below the main image with that "thumbnail" linking to that image... is there any way you could help with that?

    muchas gracias if you can.
  • acrylian Administrator, Developer
    I would like to suggest to read the theming tutorial for the basics.
  • $randomImage = printRandomImages(3, null,'album','vacation');
    if (is_object($randomImage)) {
    $randomImageURL = html_encode(getURL($randomImage));

    Not really in front of a machine where I can test that out right now, but I think it'll do what you're asking. Massage and style any elements you need to make it work. :)
  • vincent3569 Member, Translator
    gjr gave you the right tip, don't you think ?

    to display a radom pict from gallery in image.php, add something like that
    `

    <?php printRandomImages(1, NULL, 'all', '', 200, 200, false); ?>

    `
Sign In or Register to comment.