deanmoses / zenphoto-json-rest-api Goto Github PK
View Code? Open in Web Editor NEWRest API for Zenphoto
License: GNU General Public License v2.0
Rest API for Zenphoto
License: GNU General Public License v2.0
Since it is a non official plugin, that would need to be the plugin way using gettext_pl
. Not pressing needed as there are only a few strings to translate yet.
In line 240 you use that You should not rely upon the albums folder being named "albums" as it can be named differently optionally.. There are various constants for paths and folder names. Take a look here: http://www.zenphoto.org/news/path-constants/
Zenphoto's flexibility comes from being able to use any image size on themes additionally to the default ones "sizedimage", "thumb" and "fullimage" (you don't need to use these at all).
It perhaps would be overload to add all the image processor parameters on the single image request. The only way would be to use sizes registered to the cacheManager plugin. This is normally done via the current theme's themeotions.php
file.
Since Zenphoto always has a current theme, users requiring custom sizes would need to register them via a a "placeholder theme" or a plugin possibly to be able to use them.
When a gallery is in 'closed for maintenance' mode, the JSON API is not called and instead the site is redirected to a "Site is Down" HTML page.
JSON clients can't deal with the HTML. Instead, we need to return JSON like:
{
"status":503,
"error":true,
"message":"Site is down for maintenance."
}
It may be picky and I am no lawyer but am not sure if the plugin can be MIT licensed. As a plugin it includes parts derivative from Zenphoto which is GPL v2 or later. While you can incorporate MIT licensed parts into GPL, the other way doesn’t work as MIT is less strict than GPL.
Some info: https://www.gnu.org/licenses/license-list.en.html#X11License
The deep
parameter to enable the full tree could be replaced by a level
parameter :
level=0
could be all levels (former deep)level=1
current levellevel=2
current level plus next sub levelSince we use the normal front end theme urls, possibly the static_html_cache plugin could take this over later on.
Support for Zenpage news articles, categories and pages inkl. search results. I try to help with this.
I'm not sure if I'm misunderstanding the install instructions, but it seems pretty straight forward.
I placed json_rest_api.php
and json_rest_api
folder in /plugins/json_rest_api/
with 644
permissions. But I'm not seeing it show up in in the Plugins > Development
or Plugins > All
.
My system info:
Zenphoto version 1.4.14 [f5b47da52f] (Official build)
Current locale setting: en_US.UTF8
PHP version: 5.5.37
Is there something obvious I'm missing?
Some extra parameters for the gallery index page could be features like &latestimages=<number>
if the image_album_statistics is available. I could imagine that this might be needed quite often.
On large sites getting data for all albums or even the full album tree may overload servers. Zenphoto generate pagination anyway.
So we could have the main gallery index (page 1 - top level albums) and following that the page 1 of any album page return paged results or not by option. (Similar for Zenpage articles, categories later on). Same on further album levels.
I suggest an additional parameter &paged=0|1
to disable/enable paginated results.
Any further page like page 2 could by default also return just data for that page unless paged
is set otherwise.
Furthermore, the deep
parameter to enable the full tree could be replace by a parameter level
. -
level=0
could be all levels (former deep)level=1
current levellevel=2
current level plus next sub levelHello,
I am unable to get any data from the API when I use curl from a linux machine. I noticed exceptions being generated in the log. Here are some examples of calls to the API that don't appear to be functioning:
curl 'http://zenphoto...xyz/202301_January-2023/?json'
produces the following log message:
{10804:Thu, 12 Jan 2023 02:42:52 GMT}
EXCEPTION (0): Call to undefined method Album::isPublished() in /var/www/html/plugins/json_rest_api.php on line 207
and
curl 'http://zenphoto...xyz/202301_January-2023/20230102_085720.jpg?json'
produces the following log message:
{10807:Thu, 12 Jan 2023 02:47:51 GMT}
EXCEPTION (0): Call to undefined method Image::getName() in /var/www/html/plugins/json_rest_api.php on line 286
I noticed in packet captures that the zenphoto server returns HTTP 200 for each of these requests.
I installed the zenphoto-json-rest-api plugin on my zenphoto 1.5.4 instance, following the instructions in the readme. Here's what my plugin directory looks like:
root@zenphoto:/var/www/html/plugins# ls -al
total 52
drwxrwxr-x 7 www-data www-data 4096 Jan 9 21:00 .
drwxr-xr-x 10 www-data www-data 4096 Aug 10 2019 ..
drwxrwxr-x 2 www-data www-data 4096 Jun 22 2019 gd_fonts
drwxrwxr-x 2 www-data www-data 4096 Jun 22 2019 imagick_fonts
drwxr-xr-x 2 www-data www-data 4096 Jan 9 21:00 json_rest_api
-rw-r--r-- 1 www-data www-data 23479 Jan 6 00:40 json_rest_api.php
drwxr-xr-x 2 www-data www-data 4096 Aug 10 2019 site_upgrade
drwxrwxr-x 2 www-data www-data 4096 Jun 22 2019 watermarks
I also tried to use the plugin on a different server with the latest version of zenphoto (1.6), but mod_rewrite doesn't seem to be working in that version, even though I have confirmed that Apache is configured correctly for it. I couldn't find instructions in the readme about how to construct the url for zenphoto-json-rest-api when mod_rewrite is not in use.
Thanks,
Tom
The strptime function isn't implemented in PHP on Windows, so the plugin fails to work there. A platform independent replacement would be:
static function dateToTimestamp($dateString) {
$a = date_create_from_format('Y-m-d H:i:s', $dateString);
return $a->getTimestamp();
}
Currently the api gets info from gallery even if set to private and from albums/images that are protected.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.