ZenphotoCMS Forum
getRandomImage from a specific album - Printable Version

+- ZenphotoCMS Forum (https://forum.zenphoto.org)
+-- Forum: Support (https://forum.zenphoto.org/forum-1.html)
+--- Forum: General support (https://forum.zenphoto.org/forum-4.html)
+--- Thread: getRandomImage from a specific album (/thread-2187.html)



getRandomImage from a specific album - bplasma - 2008-02-04

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 "';

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




getRandomImage from a specific album - sbillard - 2008-02-04

getRandomImagesAlbum()1 will return a single image from the current album. Call it siz times and display the image each time.




getRandomImage from a specific album - bplasma - 2008-02-14

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.