ZenphotoCMS Forum
Problem using Zenphoto as a plugin - 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: Problem using Zenphoto as a plugin (/thread-7440.html)



Problem using Zenphoto as a plugin - sceilig - 2010-08-07

I am using Zenphoto as a plugin by including the template-functions.php file. I can return random images from an album but I find that some images will be returned twice.

I would prefer unique images being returned and only landscape ones. I figure I could run a query directly on the database and then use the Image class to create the image object but it gives me a Fatal Error saying "lass 'Image' not found". Should I be using a different approach?

Here is my code:
&#36;album = 'folder name of album'; &#36;result= &#36;query_full_array('SELECT i.filename, i.title, a.folder FROM '.prefix('images').' as i INNER JOIN '.prefix('albums').' as a ON i.albumid = a.id where a.folder="'.&#36;album.'" and i.width > i.height ORDER BY RAND() LIMIT 10'); for (&#36;i=0; &#36;i < sizeof(&#36;result); &#36;i++) { &#36;image = new Image(new Album(new Gallery(), &#36;result[&#36;i]['folder']), &#36;result[&#36;i]['filename']); &#36;title[] = &#36;image->getTitle(); }




Problem using Zenphoto as a plugin - acrylian - 2010-08-07

You should use the newImage() function and not the class constructor (as noted on the object model tutorial and I think even the doc)