zenphoto forums » Plugins

Zenphoto REST api - Integration with other software

(10 posts)

No tags yet.

  1. eliz82

    Apprentice
    Joined: Nov '16
    Posts: 4

    Hey guys i have made an app for Piwigo gallery that help users to post photos from gallery into other software like Worpress or various forums types. http://piwigo.org/ext/extension_view.php?eid=835

    I want to make something similar for Zenphoto.

    But i have some problems

    1) Current api seem unsupported by it's original autor. Both Piwigo and Menalto Gallery 3 have api that are officially supported and documented. Please support your Zenphoto REST api officially. They are some bugs some incomplete stuff, and there is no documentation for it.

    2) Is possible to make the derivative file names not contain the size in pixels? Because having that number in the filename easily will broke any links to the thumbnail and websize in the future.

    For example if a software like mine generate a bbcode like this for a forum software:

    [url=http://site.com/cache/someuser/filename_595.jpg][img]http://site.com/cache/someuser/filename_150_cw150_ch150_thumb.jpg[/img][/url]

    If the user change the size of the thumbnails or websize then the original link embeded in other software can be broken.
    Piwigo dont have that size included in the filenames. They use something like this
    filename-sq.jpg (square thumbnail)
    filename-th.jpg (small thumbnail)
    filename-me.jpg (websize thumbnail)
    filename.jpg (original filename)
    When user change the size option in his options panel he is not broking the past links.

    Posted 7 months ago #
  2. Zenphoto development team
    acrylian

    Zenphoto team
    Joined: Jul '07
    Posts: 16,769

    1) There is no offical REST API for Zenphoto. There is a 3rd party plugin: https://github.com/deanmoses/tacocat-gallery-zenphoto-rest-api
    I have plans to create an more complete official (read only) REST API following that principle for the next big release. That release sadly will take some time as time is sadly an issue.

    For now you would have to use RSS. There is an probably rather inconvenient externalRSS plugin you could use for now.

    2) No, those file names are the names of the cached files and they tell Zenphoto that it does not need to process this specific sizes again. That cannot be changed.
    Piwigo and WP do use a fixed set of image sizes they pregenerated. But Zenphoto does not do this and leaves the freedom to use any size in any number to theme and plugins. So there are no fixed file names possible to link to. To change the size without using Zenphoto itself you woul have to call the image processor (see zp-core/i.php): But you really don't want to allow that to everyone from the outside as that surely can overload your server.

    Don't forget to read the Forum rules and usage resources
    Posted 7 months ago #
  3. eliz82

    Apprentice
    Joined: Nov '16
    Posts: 4

    then ...

    1) nice to hear that. i already builded my zenphoto2img app one week ago based on "tacocat-gallery-zenphoto-rest-api", but this app is more primitive compared with my piwigo app. because with the current zenphoto REST api you get less info about images and albums. also is very hard to build an album tree because you cannot get that from a single api request, so i'm building only the main albums first making one request, then using ajax i'm building the subalbums for the selected album.

    also got the same bug like this guy reported 9 months ago and the autor didn't fix the problem
    https://github.com/deanmoses/tacocat-gallery-zenphoto-rest-api/issues/4

    2) then this is bad if the filename must contain the image size in pixels. this will make zenphoto links very brokeable when integrating zenphoto in any other type of software.

    Posted 7 months ago #
  4. Zenphoto development team
    acrylian

    Zenphoto team
    Joined: Jul '07
    Posts: 16,769

    1) Sorry, cannot say much to that as I didn't actually use that plugin. The plugin I have in mind will mirror the standard front end usage more or less.

    2) Well, it is how Zenphoto works and this will not be changed. Those cached images are not fixed, the cache may be deleted so it is not recommended to link to that directly with fixed links. Instead use the image processor if you are not sure. That will either create the cache image or serve existing ones. Which actually the api would do before returning anything.

    Don't forget to read the Forum rules and usage resources
    Posted 7 months ago #
  5. eliz82

    Apprentice
    Joined: Nov '16
    Posts: 4

    2) by image processor ... you mean "i.php" ?

    can you give an example how "i.php" query parameter would look like to be equivalent with this kind of links?

    websize:
    http://site.com/cache/someuser/filename_595.jpg = http://site.com/i.php?...

    thumb:
    http://site.com/cache/someuser/filename_150_cw150_ch150_thumb.jpg = http://site.com/i.php?...

    Posted 7 months ago #
  6. Zenphoto development team
    acrylian

    Zenphoto team
    Joined: Jul '07
    Posts: 16,769

    Yes, that's the image processor. Best you see the file's docblock ifself for the available parameters.

    Don't forget to read the Forum rules and usage resources
    Posted 7 months ago #
  7. deanmoses

    Apprentice
    Joined: Nov '14
    Posts: 2

    Hi, I'm the guy that wrote that unsupported REST API and didn't fix anything for a year. Believe me, I'd also love it if there were an official, supported API!

    But in the meantime I fixed up mine.

    1) The bugs people filed issues for are fixed.
    2) You get the whole tree of albums all the way down; it doesn't stop at one level.
    3) It still doesn't get as many fields as you want, eliz82. If you have specific fields I can add them. Anybody know if there's a way to iterate over all fields?

    It's at a new location:
    https://github.com/deanmoses/zenphoto-json-rest-api

    Posted 2 months ago #
  8. Zenphoto development team
    acrylian

    Zenphoto team
    Joined: Jul '07
    Posts: 16,769

    Entry on our extensions section has already been updated!

    Don't forget to read the Forum rules and usage resources
    Posted 2 months ago #
  9. eliz82

    Apprentice
    Joined: Nov '16
    Posts: 4

    @deanmoses
    The "deep" parameter seems nice, allowing me to fix one of the problems.
    I will take a look at the api new version when I will have some free time.

    @acrylian
    By "file's docblock" you mean looking at the "i.php" source code, or there is some sort of documentation for zenphoto?

    Posted 2 months ago #
  10. Zenphoto development team
    acrylian

    Zenphoto team
    Joined: Jul '07
    Posts: 16,769

    All or the majority of functions etc are documented by in file comments (called docblocks for their formatting to match doc generators). There is also a generate documentation (see the user guide) but that is generated from exactly those comments.

    Don't forget to read the Forum rules and usage resources
    Posted 2 months ago #

RSS feed for this topic

Reply

You must log in to post.