Configure dynamic download formats
When users share or download asset files, they often need different file formats. For example, different image sizes or resolutions. With dynamic download formats, you can provide different formats on-demand without a physical storage item.
Context
Dynamic download formats are configured and stored in a Module/Transformation asset. The Download asset files and Create shared link wizards use these transformations if the downloaded/shared asset matches the asset type and MIME type definitions. A transformation renders the desired format when a user triggers Download asset files or Create shared link actions
Prerequisites
None
Introduction
Dynamic download formats are configured in an XSLT. The XSLT file is stored in censhare in a Transformation asset. In the Transformation asset, you can define Asset type filters and MIME type filters. These filters are applied to the source asset. For example, if you set an asset type filter on images, the respective dynamic download format is only available if a users selects an Image asset to download or share asset files. If you set an additional MIME type filter on JPGs, the dynamic download format is only available for images with this MIME type.
Create a dynamic download transformation
As customer requirements differ widely, censhare provides only an example configuration, but no standard production-ready configurations. To install the example configuration:
Open the censhare Admin Client.
Click and select Synchronize module assets.
In the selection dialog, select optional/transformations (and deactivate optional). Click OK.
In the summary dialog, verify that a new asset is created and click OK.
In censhare Web, open the Detailed search dialog. Go to the Advanced tab.
In the Resource usage field, select File drag and run the search.
To set up a new dynamic download format, copy the example transformation or create a new asset and select the type Module/Transformation.
Configuration
Carry out the following steps in the censhare Client:
Log in to the censhare Client in Admin mode.
Select the Transformation asset and click Edit Metadata.
Edit the metadata of the Transformation asset and add the following Features (internal):
Feature | Description |
---|---|
Name | Enter a default name and localized names for the transformation asset. This name is used in the wizard and on web pages. |
Description | Enter a default description and localized descriptions for the transformation asset. |
Enabled | Resource must be enabled. |
In cached tables | Enable caching of the resource. |
Resource key | Enter a unique resource key. |
Resource usage | Select File drag. This value is required to work in the wizards and on web pages. |
Asset type filter | Enter a filter for the source asset type. You can define sub-types and use wildcards. For example: |
MIME type filter | To add a MIME type child feature, click the indented round plus, select MIME type and enter the desired filter. For example: image/jpeg. For a full list, see Master data/MIME types. |
Configure XSL transformation
The dynamic download format is created from the master storage item (Master file) of the selected assets with an XSL transformation. The transformation stylesheet must be stored in the Transformation passet. Carry out the following configuration in censhare Web:
- To create a file from scratch, go to the Editor tab, select the MIME type XSL stylesheet and click CREATE FILE. Alternatively, upload a file from your computer.
- In the XSLT provide the following parts:
- The transformation parameters.
- The root element match (the context asset).
- Parameter validation (optional).
- Retrieve master storage item from the target asset.
- Create a virtual target file.
- Execute the transformation.
- Return the resulting file (this step triggers the download action).
Make sure that important metadata are written into the target file. For more information, see Metadata handling in variants and dynamic downloads.
For an example, see the attached XSL file. With this transformation, images are rendered to a maximum size of 500x500px as JPEG. For a comprehensive documentation and more examples of available XSLT commands and source file types, see censhare XSLT commands and extensions.