ZenphotoCMS Forum
How to poll for new pictures added? - Printable Version

+- ZenphotoCMS Forum (https://forum.zenphoto.org)
+-- Forum: Support (https://forum.zenphoto.org/forum-1.html)
+--- Forum: General support (https://forum.zenphoto.org/forum-4.html)
+--- Thread: How to poll for new pictures added? (/thread-10808.html)



How to poll for new pictures added? - isaac van asselt - 03-02-2013

How can I easily check on my zenphoto site if a new picture has been added?

I don't know what the official term for something like this is (that's why I'm not finding $#@! on google and need your help).

Ideal case I would like www.mysite.com/newpic.php to return either a number (# of pictures on the site), or a timestamp of latest picture added, or a hash value. I don't mind. But not a full page and preferably also not a RSS feed, it's for a mobile purpose.

Is there anything in zenphoto or out there as extension? Otherwise I'd have to do it myself...
thanks!




How to poll for new pictures added? - acrylian - 03-02-2013

Several ways:

  • Use the functions the image_album_statistics plugin provides to show latest images.
  • Use the Zenpage CMS plugin with a supporting theme and its CombiNews mode to show images within the news section

Also there is of course RSS available.

If that all is easy depends on your knowledge of webtechniques. In any case it is recommended to get familiar with how Zenphoto themes work by reading the theming tutorial.




How to poll for new pictures added? - isaac van asselt - 03-02-2013

Thanks! These are options but I'd like to fetch only (let's say) 64 bytes and do a check "yes/no new content".

I might end up using PHP to md5 the latest image, not a bad idea.




How to poll for new pictures added? - acrylian - 03-02-2013

I don't know what you mean with fetching 64bytes exactly. But what I described is the way to get new/latest images. From there on you can do whatever checks you want. There is also the object model.

There is also a flag_thumbnail that can flag (!) thumbs to mark them visually as new within albums. You can even set the date range something is considered new.




How to poll for new pictures added? - isaac van asselt - 03-02-2013

For people that would ever need something the same, it was easy, most work is figuring out what your mysql access codes are.
This php code, named "count_pictures.php" will display nothing but number of images registered in zenphoto. It is was I needed. (The output is less than 64 bytes)

`

`




How to poll for new pictures added? - acrylian - 03-02-2013

So you want just the total count of images... That you could have got even easier.... You really should use the object model then:
$count = $_zp_gallery->getNumImages(0)
http://www.zenphoto.org/documentation/classes/Gallery.html#methodgetNumImages




How to poll for new pictures added? - isaac van asselt - 04-02-2013

If you insist this is better even in a standalone php script I can do it.
What list of includes are necessary, how would a standalone .php look like?




How to poll for new pictures added? - acrylian - 04-02-2013

So you actually want to use that outside Zenphoto (you didn't specifially tell that..). Then see this: http://www.zenphoto.org/news/zenphoto-as-a-plug-in-using-zenphoto-functions-from-outside-zenphoto




How to poll for new pictures added? - isaac van asselt - 05-02-2013

thanks, I can use this for future enhancements