An open API service indexing awesome lists of open source software.

https://github.com/tmslnz/symphony-cms-xslt-jit-toolbelt

Full-featured JIT resizing utility for Symphony CMS
https://github.com/tmslnz/symphony-cms-xslt-jit-toolbelt

symphony-cms xslt

Last synced: about 1 month ago
JSON representation

Full-featured JIT resizing utility for Symphony CMS

Awesome Lists containing this project

README

        

Magical Image Resize Utility
============================

By The Workers London Ltd.

# Overview
Magical image resizer and tag generator, with fallback to [DummyImage generator][dummy].

[dummy]: https://github.com/robphilp/Symphony-2-Dummyimage

## Required params:
- `upload`: takes an xPath of Symphony's `` node
- if `upload` is omitted, it will generate a dummy image with the specified dimensions (`w` and `h` dimensions required in that case)

## Optional params:
- `'w'`: the requested width
- `'h'`: the requested height (both can be set)
- (standard `` attributes. `class`, `id`, `title`, `name`, `longdesc`, etc.)
- `value-only`: if set to either `'w'` or `'h'` will return only the result number not the whole `` tag.
- `mode`: `'normal'`, `'fit'`, `'max'`
- normal: none, `'w'`, `'h'`, `'w'` and `'h'`
- fit: `'w'` and `'h'`
- max: `'w'`, `'h'`, `'w'` and `'h'`
In normal mode the scaler takes whatever `h` and/or `w` is passed and scales the specified dimensions to whatever value was passed.
If either `w` or `h` are passed, then the missing value is derived proportionally. If both values are passed then both are applied, effectively constraining the image to a specified size.
In fit mode both h and w are required. The two values define the area within which the scaler has to proportionally fit the image.
- `JITmode`: JIT modes (see docs on Symphony-CMS.com)
- `JITcenter`: JIT center `1` to `9`
- `JITexternal`: `0` or `url` (without the `http://` part)

## Examples

### Output original size
_No explicit size = original size_



### Force a specific size
_Specifying both dimensions, using no explicit mode, will output exactly what you asked for._





### Scale proportionally based on width or height constraint
_To trigger this simply omit one dimension_




### Scale proportionally within a set bounding box (square or not)
_This is useful if you want to proportinally constrain your images to set dimensions._






### Set a grid and trim exceeding values from automatically calculated dimensions
_Makes sure that any automatically calculated value will be a (nearest neighbor) multiple of the grid you set._







### Set a grid and use multipliers
_Straighforward. W and H values are used as multiplier in this case._






### Use and external image
_w and h needed as we don't have XML metadata on the fetched image_





### Generate a dummy image (needs Dummy Image extension)
_Note that we are not passing any upload param in this case._




### Use it as a MATCHED template



### Add attributes (works in all modes)







## Notes
When this template is used as a match rather than called by name, the DummyImage mode is effectively inaccessible.
Besides, it wouldn't make sense since you if have a match, then you have an upload.

By The Workers London Ltd. [theworkers.net][w] - [[email protected]][io]

[w]: http://theworkers.net/
[io]: mailto:[email protected]