Member
Member
DBR   2018-06-22, 19:41
#1

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.

Administrator
Administrator
acrylian   2018-06-22, 20:50
#2

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.

Member
Member
DBR   2018-06-23, 00:30
#3

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!!

Administrator
Administrator
fretzl   2018-06-23, 09:31
#4
  1. Enable [i]slideshow2[/i] plugin.
    Set [i]Slideshow: Mode[/i] to Jquery Cycle
    [i]Slideshow: Slide width[/i] and [i]Slideshow: Slide height[/i] will be overriden by parameters in the printSlideShow() call.
    Check [i]Slideshow: Description[/i]
    Make sure the slideshow scripts are loaded.
  2. Create an album object.
    $my-albumobject = newAlbum('your-slideshow-album-name');
  3. Place the [i]printSlideShow()[/i] function where you want the slideshow to appear and set the parameters you want.
    (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);
  4. Use CSS to style and position the description.
Member
Member
DBR   2018-06-23, 17:04
#5

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)

define('SERVERPATH',str_replace('\','/',dirname(FILE)).'/zenphoto');
define('WEBPATH','/zenphoto');
require_once(SERVERPATH.'/zp-core/template-functions.php');
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.

Administrator
Administrator
fretzl   2018-06-23, 17:58
#6

You are using

define('SERVERPATH',str_replace('\','/',dirname(FILE)).'/zenphoto');

instead of

define('SERVERPATH',str_replace('\\','/',dirname(__FILE__)).'/zenphoto');

?

Member
Member
DBR   2018-06-23, 18:20
#7

Formatting changed it here - yes, I'm using with underscores. And, verified that it is correct, printing out SERVERPATH.

Administrator
Administrator
acrylian   2018-06-23, 19:21
#8

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.

Member
Member
DBR   2018-06-23, 23:23
#9

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...

Administrator
Administrator
acrylian   2018-06-24, 08:45
#10

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.

Member
Member
DBR   2018-06-25, 18:36
#11

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.

Administrator
Administrator
acrylian   2018-06-25, 18:51
#12

Great. Thanks for the follow up and confirmation that this way of usage indeed still works.

  
Powered By MyBB, © 2002-2026 MyBB Group.
Made with by Curves UI.