Thank you for making ZenPhoto. I am glad that I found it.
What is the best URL to use for an image thumbnail, such as one might use in a blog post? I have seen the two following types of URLs for thumbnails in ZenPhoto. Is one of these preferred over the other, or is there a third type of URL that I am not aware of?
https://www.blackgate.net/gallery/cache/Collections/Mugs_of_August/2011_August_02_595.jpg
I have searched here for a solution, but it seems that most people want to prevent hotlinking, not make it easier.
Thank you.
What if it is not cached? Surely there is a stable url that one can use for thumbnails, yes?
That url is stable but if the thumb is not cached there is no thumb at all.
http://www.zenphoto.org/news/caching
In which case, that is not useful. So the first link the best one to use, then.
No, it is not. Please read carefully how image resizing and caching works on Zenphoto. The first link will always run the image processor to create the thumb even if it is existsing already. If you have a lot of visitors and do this in lots of places you will create quite some unnecessary overhead on your server. Please be prepared to time outs especially if you are on shared hosting.
[deleted because I want to rephrase it]
I want to rephrase that, because I thought my first reply sounded argumentative.
What I want is a url that links to a thumbnail for an image. Typically, such a url would be a link to a script that returns the cached version (creating the cached version first, if it does not already exist).
It seemed reasonable to me to assume that Zenphoto would have this functionality, but it sounds like it may not.
Does Zenphoto have this functionality?
Well, the image processor does this, but it will also always check if it needs to cache -> overhead since there is file system operation involved that may not be necessary.
What you probably actually mean is an API for outside access. We don't exactly have one. The externalFeed plugin might be a workaround.
Use the image processor URI link. That one will always work. It will cache the thumbnail if it has not been cached. If it has already been cached it will serve the image from the cache.
Not quite as efficient as the browser directly fetching the cached image, but it will work whether or not there is a cached copy. The cache link will, of course, fail if you clear the cache or otherwise there is no cache copy of the thumbnail.
Thanks. I have a follow-up question. If I view all of the images first, that will create the cached thumbnails, yes? Are there any cases you know of when the cached images will expire and be deleted? Or, once they have been created, can I be reasonably sure that they will continue to exist at the same url?
Ah, splendid. Then I can link to the cached thumbnails, as long as I make sure that the cached images exist first, which they will, as long as I have viewed the album in Zenphoto once before linking to the image.
Thank you for your patience. This has been very helpful.