ZenphotoCMS Forum
Daily Random Image from 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: Daily Random Image from Specific Album? (/thread-4946.html)



Daily Random Image from Specific Album? - harootun - 2009-04-01

I'd like to add a random image from a specific album that changes daily. I've gotten the printrandomimages function to work, but I don't see anything in there about making it daily. I see getRandomimages function, which has daily, but nothing else. I see getRandomImagesAlbum, which has a specific album.

I think there is probably a way to combine the functions to show a daily random image from a specific album, but I don't know how to do it. Can anyone suggest the possible code that could be used?

Thanks in advance!!




Daily Random Image from Specific Album? - sbillard - 2009-04-02

The code that handles the daily image is
if ($daily) { $potd = unserialize(getOption('picture_of_the_day')); if (date('Y-m-d', $potd['day']) == date('Y-m-d')) { $album = new Album($_zp_gallery, $potd['folder']); $image = newImage($album, $potd['filename']); if ($image->exists) return $image; } }
You could create a new custom function that incorported this code. The fallthrough should use the getRandomImageAlbum() function to get a new image and then

if ($daily) { $potd = array('day' => time(), 'folder' => $result['folder'], 'filename' => $imageName); setOption('picture_of_the_day', serialize($potd)); }
To save off the new image.

This code has all been extracted from the getRandomImages() function.




Daily Random Image from Specific Album? - harootun - 2009-04-02

Thanks for the rapid response. Still struggling to get it working, but hopefully will have success.