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 aModule/Transformation asset. The Download asset files and Create shared linkwizards 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 aTransformationasset. 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 anImageasset 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.
Note:Do not confound the Asset type filter and MIME type filter of the source asset with the format and MIME type of the target file. censhare XSLT allows to change the format and MIME type. For example, you can define aDynamic download formatthat is only available for PNG image assets, and set the download format and MIME type to JPG. The format and MIME type of the target file are configured in theXSL transformation file, not in the asset properties.
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.
Clickand select Synchronize module assets.
In the selection dialog, select optional/transformations(and deactivateoptional). Click OK.
In the summary dialog, verify that a new asset is created and click OK.
In censhare Web, open the Detailed searchdialog. Go to theAdvancedtab.
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 Transformationasset and add the followingFeatures (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
SelectFile 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: picture.filters only Image assets. picture.*filters Image assets and all sub-types. picture.icon.filters only Icon sub-type assets. For a full list, seeMaster data/Asset types.
MIME type filter
To add a MIME type child feature, click the indented round plus, selectMIME typeand enter the desired filter. For example: image/jpeg. For a full list, seeMaster 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).
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, seecenshare XSLT commands and extensions.
JavaScript errors detected
Please note, these errors can depend on your browser setup.
If this problem persists, please contact our support.