Caching of image occurs, although not needed

Not a good description :) but this is what I get:

1. I use printDefaultSizedImage to display the image
2. I upload only images that are 600px longest side
3. I set upscaling to none
4. I set max image size longest side also to 600px for galley and albums
5. I set image quality to 100 for the large/middle size (although I don't have/want a middle size) and the thumbs to quality 70.

Now I can see that although the images are 600px and 50kb in size when uploaded, in the cache folder there appears a cached image of 600px, 140kb in size!

Three years ago I had this problem. Have I forgotten something?

http://www.zenphoto.org/support/topic.php?id=2985

Comments

  • Sure, so you want us to not cache the image if the size is already the needed size, etc.? In fact once-upon-a-time this was what did happen.

    But there is a serious problem with that strategy. Caching an image happens only once per "size" and takes some disk space. Testing to see if the image should be cached happens every time the image is referenced for display in any way. So the trade-off is storage space vs. processing overhead. With the cost of disk so low these days the choice is a no-brainer.
  • Ok, but what happens with the quality? When I upload a 600px 50kb image, and it is cached as a 600px 150kb image, that's no good for speed, is it? And if I set the image size to jpg 70, then my already reduced quality jpegs are again reduced with quality setting 70, making all my photoshop work useless.
  • If you do not like the quality of the GD library processing then you should use Imagick.
  • The quality is good, when uploading a larger image that has to be brought back to a desired size and set to a jpg quality of 70. No complaints there. But why transforming a perfect image of 600px into another 600px copy of 'lesser' quality?

    I'm just trying to be logical about this. It's not about disk space. A simple solution would be if there would be an option in the admin panel where users can set the image quality of the uploaded image to 1. using the slider for the desired quality, or 2. don't use the slider and use uploaded image instead.

    You see, I don't use a 'middle' image. I only use a thumbnail that points to the 600px image.
  • acrylian Administrator, Developer
    Sbillard actually explained why sized images are always processed. It is a technical and performance issues.
    Zenphoto has three types of images in a standard theme:
    1. thumbnails
    2. sized images (the ones on image.php single display)
    3. full image (in standard themes opened via Colorbox for example).

    There is no "middle" image actually.

    So if you don't want the image on image.php without processing and the images have already the correct size you alway can change your theme to call the full image directly instead.
  • Ah, thanks! :) Now I only have thumbs in my cache folders :).

    `<?php $fullimage = getFullImageURL(); $fullimagetitle = getImageTitle(); echo "<img src=\"" . $fullimage . "\" title=\"" . $fullimagetitle . "\">"; ?>`
Sign In or Register to comment.