The simpler media website CMS
I'm programming my own php page, and I want to get the images in a specific album. Documentation says to use the object model, rather than direct mysql queries.
First, how do I get access to the methods? Include?
After that, can I just use the following:
$theAlbum = new Album('myalbum');
$theImages = $Album->getImages();
Thanks for any direction and help.
Comments
The doc refers naturally to usages within Zenphoto context of themes and plugins. If you are referring to external usage take a look here: https://www.zenphoto.org/news/integration-with-existing-sites-and-other-cms/
Maybe investigate if creating a theme isn't the easier way. Zenphoto theming is quite flexible.
There is also a third party REST API plugin - well in fact I am a bit involved in it, too – that allowe extern fetching:
https://github.com/deanmoses/zenphoto-json-rest-api/issues
You cannout MySQL queries because of inheritance of albums regarding visibility and protection. A subalbum may be published but it is not if the parent album is not but the db entry itself does not have info about that.
Thanks for this info, I'll look into it.
Maybe there is an easier way to do what I need... I have a small (250px wide) slideshow based on a fixed, specific, non-public album on my home page. The other albums are all just used as albums in a regular gallery. I tried to use the slideshow within Zenphoto, but then all slideshows are only 250px rather than full size. So far, I was doing a mysql query to get images from this specific album, which worked; but then adding in descriptions was not working. Desc's showed up in the table .images but not xx_images. If that makes sense...
Any help would be greatly appreciated!!
Set Slideshow: Mode to Jquery Cycle
Slideshow: Slide width and Slideshow: Slide height will be overriden by parameters in the printSlideShow() call.
Check Slideshow: Description
Make sure the slideshow scripts are loaded.
$my-albumobject = newAlbum('your-slideshow-album-name');
(https://docs.zenphoto.org/function-printSlideShow.html)
It will probably look something like: printSlideShow(true, false, $my-albumobject, NULL, 250, 250, true, true, false, false);
Thank you so much, this should be perfect and I like using their slide show. But I'm using this from a non-zenphoto page (just my own index.php), so I need to include the zen library. I tried the code on
https://www.zenphoto.org/news/integration-with-existing-sites-and-other-cms/ (using my correct directory)
But I get a 500 error on the require_once statement. What is the proper way to get access to the zenphoto library?
Thanks again for the help; I'm just not finding much doing my own searches.
You are using
instead of
?
Formatting changed it here - yes, I'm using with underscores. And, verified that it is correct, printing out SERVERPATH.
Also the double backward slash? Since that is also different in your example (may also be the formatting). Something must be not correct if the file is really in that place.
Yes, the double slash is correct too (formatting issue here). The file is definitely found properly, and the resulting 500 error comes up, with no error message in the log. I verified that if I change "template-functions" to a wrong name I get a file-not-found error in the log.
So requiring template-functions.php should work? And will include the class methods needed?
I can try reloading that file, but the gallery itself works just fine...
Technically it should include the classes - not sure about plugins - but I have to admit we don't really use or test this usage way regulary. It is a kind of workaround.
Just to close the loop here... I got everything to work. Turns out that I had two functions with names that conflicted with the zenphoto functions: db_error and db_close. Once I renamed my routines things fell into place. Thanks so much for your help.
Great. Thanks for the follow up and confirmation that this way of usage indeed still works.