Jump to content
Sign in to follow this  
CaptainKaos

Image Compression / Caching

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

Share this post


Link to post
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).

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Sign in to follow this  

×
×
  • Create New...