cache

Method

/cache/path/:path:to:image.jpg/name/image.jpg

Spring has some advanced options for automated processing and caching of images controlled simply by modifying the path to the image file.

Processed files are saved to disk on the server, and Spring uses these for maximum performance. If Spring is unable to locate a previously processed file, it will load, process and save the resulting file into the cache on the fly.

This script can not be called from within CSS files. If that functionality is required you will need to include them within stlyes in head.xml

Minimal options

/cache/path/:path:to:image.jpg/name/image.jpg

Additional Options

Additional options can be specified by appending them to the URL prior to the final filename:

/cache/path/:path:to:image.jpg/<option-name>/<value>/name/image.jpg

Options:

/height/<number>

/width/<number>

/crop/1

/round/<number>

/rotate/<number>

/mask/:path:to:mask.png

/gray/1

/sepia/1

/level/1

/whitebalance/1

/contrast/<number>

/format/<jpg|png|gif>

/quality/<number>

The /path/ and /mask/ value is the full path to the file, with forward slashes '/' substituted with colons ':'.

Random Images

You can load a random image from a directory by making the /path/ value point to a folder instead of a file:

/cache/path/:path:to:folder:/<option-name>/<value>/name/random.jpg

The /name/ value can be anything (it is ignored) but for clarity we recommend calling it random.jpg or random.png.

Examples

This is the original image called through the image cache with minimal options:

Mask

/mask/<:path:to:file.png>

To overlay a mask on an image, you need a transparent png file ideally the same dimensions of the final image to be displayed. The mask file will be overlayed on top of the image, allowing the image to appear through the transparent parts.