![]() |
|
"fixed" getRandomImagesAlbum() - Printable Version +- ZenphotoCMS Forum (https://forum.zenphoto.org) +-- Forum: Support (https://forum.zenphoto.org/forum-1.html) +--- Forum: Themes (https://forum.zenphoto.org/forum-5.html) +--- Thread: "fixed" getRandomImagesAlbum() (/thread-1664.html) |
"fixed" getRandomImagesAlbum() - ulfben - 22-09-2007 I was having problems with the random image header crapping out when a sub-album had only child albums and no pictures of it's own. The original getRandomImagesAlbum() is built on a very long SQL-query which I couldn't quite wrap my head around. Thus I set out to rebuild and improve upon it, and this is my solution. It'll select 1 random image from the current dir or any of it's subdirs - and is not limited by the depth of the directory tree. [b]EDIT:[/b] [b]EDIT2:[/b] `/* Returns the ID of all sub-albums, relative to the current album. If $_zp_current_album is not set, it'll return null.*/ function getAllSubAlbumIDs() {
} /* Returns an Image-object, randomly selected from current directory or any of it's subdirectories. returns null if $_zp_current_album isn't set, and if no images can be found. You might want it to fall back on a placeholder image instead. */ function getRandomImagesAlbum() {
} ` "fixed" getRandomImagesAlbum() - aitf311 - 22-09-2007 Good fix, I put this in the latest SVN "fixed" getRandomImagesAlbum() - ulfben - 22-09-2007 Sorry, I seem to have mushed a prefix while cleaning this up for BBPress.
Is what line 60 should say. "fixed" getRandomImagesAlbum() - aitf311 - 22-09-2007 sbillard did some improvements to it and it should be working like a champ now in the latest SVN. |