Giter Club home page Giter Club logo

zenphoto-json-rest-api's People

Contributors

acrylian avatar deanmoses avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

Forkers

acrylian

zenphoto-json-rest-api's Issues

Gettext for error messages

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.

Custom image sizes

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.

Return JSON when site is closed

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

Replace deep parameter with level parameter

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 level
  • level=2 current level plus next sub level
  • and so on

Cache json results

Since we use the normal front end theme urls, possibly the static_html_cache plugin could take this over later on.

Zenpage support

Support for Zenpage news articles, categories and pages inkl. search results. I try to help with this.

Not showing up in ZP after installation.

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?

Pagination support

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 level
  • level=2current level plus next sub level
  • and so on

Exceptions generated when calling the API

Hello,

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

Replace strptime for Windows compatibility

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();
	}

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.