Jump to content

Image Compression / Caching


CaptainKaos

Recommended Posts

i guess when you guys do the caching for images your using the server to do so 

but were in the code do you give a value of how much compression to apply 

can this be changed in store code some were / or even in the DB

Thank you

Link to comment
Share on other sites

CubeCart will use the source image to create derivative images that approximately match the screen real estate afforded to an image. That is, a source of an 800x800 pixel image will be used to derive a 270x270 pixel image for that area of the template where that size image is to be placed.

The skin's config.xml file is used to denote the named purpose of the derived image, the compression 'quality' value, the name of an alternate image to use if there is no source available, and its size. For example:
<image reference="normal" maximum="270" quality="80" default="noimage.png" />

The derived image is given a filename specific to its size: stuffed_penguin.270.jpg, for example. When some CubeCart code is to deliver the "normal" size image for a particular skin page, the filename is calculated and, if found in the cache, the name is given to the template variable. If the calculated filename is not found, CubeCart attempts to create it and cache it. If successful, the filename is given to the template, else the alternate filename is given to the template.

You can change the maximum and quality values to suit your needs for each referenced size. (With plenty of pre-planning, you can even pre-load the image cache with customized versions of the product images. However, clearing the image cache will destroy all that effort.)

The filenames for the derived images in the cache are calculated every time -- only the base name of the image, stuffed_penguin.jpg, is databased in the Cubecart_filemanager database table, and other tables glue the image(s) to the product(s).

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...