The Asset Transformer module provides a simple yet powerful way for clients to use repurposed versions of images stored in their Asset Bank on their public-facing websites.
- You need store only one high-resolution version (i.e. the ‘master’ copy) of each image in Asset Bank. The repurposed versions are created on-the-fly as needed.
- Crop areas can be positioned for each asset, to ensure you get the best crop for each repurposed image.
- The repurposed images are served from a CDN (Content Delivery Network) meaning they are delivered quickly and reliably, with no dependency on your Asset Bank (once the images have been cached). Therefore it is ideal for mission-critical websites.
- You can programmatically construct the URL of each repurposed image, using the predefined crop/size identifier and the asset ID (which can be obtained from a REST API search).
Configuring the predefined sizes
Admin users can define the crop sizes, representing the sizes they need in external applications, for example on their website:
Selecting the crop areas for each asset
Assets first need to be made available for cropping. This allows you to decide which ones qualify (e.g. product images, but not images of staff). To mark assets as available for the Transformer Module you need to set the 'Available to Image API?' attribute to 'Yes' - e.g. on upload or via a bulk update of the assets in question.
Users with edit permission on an asset will then see a button “Edit Crops” on the Asset Details page, and also as a rollover on every thumbnail on the search results page.
The Edit Crops button appears when you have allowed it via the attribute 'Available to Image API?'
When they click to edit the crops, they see a page that enables them to select a rectangular area for each of the predefined crop sizes, to specify which part of the image should be cropped.
To prevent all assets in the Asset Bank from being made publicly available, an attribute “Available via Image API” can be set to “Yes” or “No”. This would be set to “Yes” for the assets you want to use on your website.
Obtaining the images for your website
In your website code, the resized and cropped images are obtained by calling a URL in the following format:
The first time the URL is called, the source file in Asset Bank is used to create the resized, cropped, web-ready version which is stored in Amazon S3. This is then cached in Amazon CloudFront and served from there, so subsequent calls will be extremely fast.
If you haven’t manually defined a crop, Asset Transformer will perform an autocrop where the crop is centred and takes up as much of the image as possible. Assets still need to have “Available via Image API” set to “Yes”.
An example of the autocrop behaviour when no crop has been set