getRandomImage from a specific album

please forgive me if this question is super noobed out...

i am looking to create a page that displays 6 random images from a specific gallery.

i found the code on the zp.org site used to display a single random image from *all* galleries and it works well:

$randomImage = getRandomImages();
$randomImageURL = getURL($randomImage);
echo "<img src='".$randomImage->getSizedImage(getOption('image_size')) . "' alt=\"random image\"\n" . $randomImage->getTitle() .'" />';

i also found the getRandomImageAlbum function, but am unsure how to use it from a page that is not within an album (i.e. splash page on site).

my questions:

1. how can i specify a gallery to choose the images from?
2. do i need to put the above block of code in the page 6 times to achieve this effect?

thanks very much for the help.

JP

Comments

  • `getRandomImagesAlbum()1` will return a single image from the current album. Call it siz times and display the image each time.
  • Thank you very much for the response. This sounds perfect. One last question, is there a way to specify an album as a variable in the page instead of in the URL?

    My intent is to have the front page of my website (i.e. http://domain.com/index.php) display 6 images from a specific gallery. For a reference, I have it running here, using pMachine:

    http://joshuapickering.com/

    Again, many thanks for your help.
Sign In or Register to comment.