Skip to main content
Skip table of contents

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.

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 a  Dynamic download format  that 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 the XSL 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:

  1. Open the censhare Admin Client.

  2. Click 

     and select Synchronize module assets.

  3. In the selection dialog, select optional/transformations  (and deactivate optional). Click OK.

  4. In the summary dialog, verify that a new asset is created and click OK.

  5. In censhare Web, open the Detailed search  dialog. Go to the Advanced  tab.

  6. 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:

  1. Log in to the censhare Client in Admin mode.

  2. 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:
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, see  Master data/Asset types.

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:

  1. 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.
  2. 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.

JavaScript errors detected

Please note, these errors can depend on your browser setup.

If this problem persists, please contact our support.