Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

This section describes the new dfsmedia pipeline and its capabilities. For a description of the old media pipeline, see this link section 5.2.

Understanding the request

The new dfsmedia pipeline is accessible on the following endpoint: http(s)://<sitecore>/dfsmedia

The syntax of the url is: dfsmedia/[SiloId]/[AssetId]-[Quality]/resize/[Width]x[Height]/compress/[0-100]/options/[Options]

And each parameter describedIf a parameter is not optional, it may be discarded, but it has to follow the order above. For instance if you want to compress only, then the following scheme is used: 

dfsmedia/[SiloId]/[AssetId]-[Quality]/compress/[0-100]

Each parameter is described as follows:

Field

Description

SiloId

This is the Id of the silo that has the asset requested.

AssetId

Is the Id of the asset that is requested.

Quality

Overrides the quality specified in the Sitecore field.

Quality supports both 'by name' and 'by id'

Resize

Only applies to image assets.

One of the concepts and principles when using a DAM system is to use specific qualities for every use. If images are needed in different sizes, it should be configured in Digizuite™ DAM.

However, there is a resize feature.

Width How wide the image will be in pixels.

Height How high the image will be in pixels.

By default a resize does not keep aspect ratio, but you can set an option to keep aspect ratio.

Compress

*

Only applies to image assets.

Indicates whether the asset should be saved using a worse quality, thereby reducing the physical size. 

from 0-100 is allowed, where 0 is the worst quality, but least physical storage.

Options

*

Options is a dash ("-") separate list and can contain these options:

download - Will download the asset requested.

keepaspectratio - Will enforce aspect ratio on from the original asset, if a resize is requested.

upscaleallowed - Will allow upscaling an image. The default is to disallow that.

*Optional

Understanding the DigizuiteMediaCache

The DigizuiteMediaCache is where everything, execpt videos, is saved. The cache location is configurable and is located in DFS.Settings.config

...

The default location is in the website root under App_Data/DigizuiteMediaCache/.

Files are cached based on the request made to the asset. An example request could be: http(s)://<sitecore url>/dfsmedia/29a605d46a3340418c16542f7272c3ec/110-50035

...

The extention is retrieved from the file saved in the cache. The naming scheme enable unique names and hence the extention can be extracted from the file in the cache. Orginally the file is saved with the correct extention based on what is served from the Digizuite.

UNC path

The dfsmedia pipeline also supports having a centralized cache, which means multiple servers can have the same cache. This decreases storage, but also performance, because files are then cached on a UNC which is slower than having it locally. This is something each client has to have an opinion on.

Implementation

The new dfsmedia pipeline is implemented as a httphandler, using a pipeline in Sitecore. This pipeline is located in the DFS.Services.config file:

...

Info
titleHint

Outcommenting the security part of the pipeline increases performance of the cost of security, but for content delivery servers for public websites, this is typically not important and therefore it may be beneficial to outcomment this step. 

Extending the pipeline

If the pipeline is to be extended, for instance if some custom processing needs to be done to the image, then this may be done in between any of the steps above.

...

ParametertypeDescription
ResultPathstringPath to the directory in which the asset is cached
FileNamestringName of the cached asset
CachedboolBoolean to indicate whether the asset is cached
ResultStreamTask<Stream>Handle for the result stream used to get the asset from Digizuite
ResizeBytesbyte[]If the image is resized and/or compressed, this array contains the result bytes
DownloadUrlstringRedirect url for download requests
StopPipelineboolIf the pipeline should be aborted, for instance due to security violation, then this is true
AssetAssetIndexableAsset model from the index
StatusCodeHttpStatusCodeStatus code used to indicate the request status.

Changing the url

If the new "dfsmedia" pipeline is used, it is possible to use another prefix for the media url. An example could be that one wanted the company name instead of dfsmedia as the media url prefix. This can be done doing the following:

  1. Change setting: DFS.MediaPipeline to new prefix (e.g. company name) in config file DFS.Settings.config
  2. Change path in httphandler section in web.config (See link, section 3.1) to be the new prefix
  3. Change trigger in customHandlers section in DFS.Services.config to be the new prefix
  4. Resynchronize the silo

Doing this ensures the following URL scheme: http(s)://<sitecore url>/<new prefix>/29a605d46a3340418c16542f7272c3ec/110-50035

Manually deleting cache entries

The cache is invalidating if the image in Digizuite is re-transcoded. The cache invalidation results in all the entries for the given asset, being deleted. If one wishes to manually clear the cache this is also an option. There are two ways in which this can be accomplished:

  • Manually deleting the folder in the cache (i.e. delete the folder that has the assetid of the asset that should be deleted).
  • Call the following endpoint in Sitecore: http(s)://<sitecore url>/damforsitecore/mediacache/assetactions/<assetid>, which will also delete the cacheentry for the given assetid.