Thumbnail url for external link

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/zp-core/i.php?a=Collections/Mugs_of_August&i=2011_August_02.jpg&s=595&cw=0&ch=0&q=85&wmk=!&check=6570c91b09702b678700ccd6551fdd25276e6390

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.

Comments

  • acrylian Administrator, Developer
    The first links to the image processor that would be called anytime the page with the image is called. That would cause unneeded overhead.

    So the second is the preferred one. To use it you need to make sure that the image is actually cached.
  • What if it is not cached? Surely there is a stable url that one can use for thumbnails, yes?
  • acrylian Administrator, Developer
    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.
  • acrylian Administrator, Developer
    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?
  • acrylian Administrator, Developer
    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?
  • acrylian Administrator, Developer
    The image cache does not expire by itself unless you clear it manually. If you change file sizes it will create new images for those sizes but not delete the old ones.
  • 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. :)
Sign In or Register to comment.