Generating Multiple Image Sizes

Hi,

I have had a quick look at how the thumbnails are generated, and how they are not stored ALL the time, (unless we work around the max cache value). I would like to do the same thing but for different file sizes also. I would like to feed zenphoto the largest file I want to offer, then have it generate 3 smaller sized images that I coult like to and have the user download. They should begenerated like the thumbnails and be bound by the same max_cache values.

If anyone could give me a few pointers on the best way to do this, I would really appreciate it.

Comments

  • trisweb Administrator
    It's misleading, but we don't use max_cache at all right now.

    If you want to give people 3 sizes, just give them in the URL and Zenphoto will generate them on request if they haven't been already. If they have, it redirects to the cached image.

    Example links from my gallery in three sizes:

    `http://www.trisweb.com/photos/Berkeley+4-10-2006/image/800/_4106695.JPG

    http://www.trisweb.com/photos/Berkeley+4-10-2006/image/595/_4106695.JPG

    http://www.trisweb.com/photos/Berkeley+4-10-2006/image/300/_4106695.JPG`
    And the thumbnail:
    `http://www.trisweb.com/photos/Berkeley+4-10-2006/image/thumb/_4106695.JPG`

    Since it redirects to the cached version, the easiest way to get this URL is to right-click the image or thumbnail in zenphoto and select "Copy Image Location" in Firefox.

    Or edit the image page url like so, adding a `/image/[size]` between the album and filename:
    http://www.trisweb.com/photos/Berkeley+4-10-2006/_4106695.JPG becomes http://www.trisweb.com/photos/Berkeley+4-10-2006/image/595/_4106695.JPG

    The point is, zenphoto can produce images on demand at any size at any time. It's part of the beauty of it that people don't often catch on to. ;-) You got the idea.
  • I got the idea. Thanks heaps. I had no idea it COULD do this already and it will save me heaps of time.

    Cheers.
  • Okay. Sorry, but how do I do this dynamically? Is there there a function I can call that will give me the name of the linked file, but ONLY the file name.

    See, I want to do this dynamically, and it would be great if I could just include the album path, the image size and then the image file name.

    Thanks again. I really had no idea zenphot was that powerful.
  • Again. Sorry. I found it. `getSizedImageURL($size)`

    Thanks again.
Sign In or Register to comment.