Skip to main content
Skip table of contents

Configure dynamic download formats - SysAdmin

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. A transformation renders the desired format when a user triggers Download asset files or Create shared link actions

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.

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

Note: Carry out this configuration 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 

 , select MIME type and enter the desired filter. For example: image/jpeg. For a full list, see Master data/MIME types.

Configure XSL transformation

Note: Carry out this step in censhare Web.

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 asset. 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 you computer.

The XSLT must contain the following parts:

  1. Provide the transformation parameters.

  2. Provide a root match (the context asset).

  3. Validate the parameters (optional).

  4. Retrieve the master storage item from the target asset.

  5. Create a virtual target file.

  6. Execute the transformation.

  7. Return the resulting file (this step triggers the download action).

For an example, see the attached XSL file Dynamic_file__Image_max_500x500px_JPEG.xsl or dynamic-jpeg-250x250px.xsl. With this transformation, images are rendered to a maximum size of 500 x 500 px. For a comprehensive documentation and more examples of available XSLT commands and source file types, see censhare XSLT command and extensions in the censhare Developer Guide.

JavaScript errors detected

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

If this problem persists, please contact our support.