![]() |
|
daily random image 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: daily random image from a specific album ? (/thread-7710.html) |
daily random image from a specific album ? - vincent3569 - 2010-10-12 on my site, I have a page with the picture of the day but I would only use the images of a single album, not all images of the gallery. there is the function getRandomImagesAlbum() for that, but this function does not have an image per day. how can I do to get a daily random image from a specific album? thanks for your help daily random image from a specific album ? - sbillard - 2010-10-12
daily random image from a specific album ? - vincent3569 - 2010-10-21 hello i have tried to use this script, but it doesn't work. daily random image from a specific album ? - sbillard - 2010-10-21
daily random image from a specific album ? - vincent3569 - 2010-10-28 hello I followed your advice and wrote the following code in the Codeblock1 of a new page. ` ` but it does not work and I always have a random image that is provided.
Can you help me to solve my problem ? daily random image from a specific album ? - sbillard - 2010-10-28 I may be blind, but I do not see what might be wrong. You will have to do some debugging. If you keep getting a new image on the refresh it means one of two things.
Once you determin what went wrong you can put in debug code to see why. daily random image from a specific album ? - vincent3569 - 2010-11-04 hello i follow your instructions like that : Results :
according to you, where is the problem ? daily random image from a specific album ? - sbillard - 2010-11-04 You have some problem with the album name you have specified. Perhaps it does not exits? BTW, you must be getting PHP script errors since if the image is NULL, the next statemet that uses it as an object will fault. So I think you best find your CGI error logs and find what errors you are getting. That may also help us. daily random image from a specific album ? - vincent3569 - 2010-11-04 I tried with a new album. $specific_album = new Album($_zp_gallery, "mariage");
where can I find my CGI error logs ? daily random image from a specific album ? - sbillard - 2010-11-04 You will have to ask your ISP about where the CGI logs are found. But I think I see the problem. getRandomImagesAlbum() expects the folder name of the album (if you are not using the current album). Looks like you are passing an album object. daily random image from a specific album ? - vincent3569 - 2010-11-04 hello there is the code : $specific_album = new Album($_zp_gallery, "mariage"); with that code, $specific_album is an album object, don't you think ? daily random image from a specific album ? - vincent3569 - 2010-11-04 sorry, I have not read your message correctly. Quote:if (is_null($image) || !$image->exists) { daily random image from a specific album ? - vincent3569 - 2010-11-04 here is the new code : ` ` with that, it ok, the random image is taken in the good album "mariage". ...but, the image changes each refresh of the browser (the initial problem still the same). the first "if" is ok, but the album returned by $specific_album = new Album($_zp_gallery, $potd['folder']); ` daily random image from a specific album ? - vincent3569 - 2010-11-04 hello I finally understood the problem the following code was wrong : if (is_null($image) || !$image->exists) { $image = getRandomImageAlbum($rootalbum); $potd = array('day' => time(), 'folder' => $result['folder'], 'filename' => $imageName); setOption('picture_of_the_day', serialize($potd)); } ` because it is a copy/cut of getRandomImages() function. the following code to have a daily random image from a specific album works well : ` ` in fact, it would be a nice improvement to modify getRandomImagesAlbum() function to have a daily random image from a specific album. daily random image from a specific album ? - sbillard - 2010-11-04 It will be in the next release. |