DFO 4.0.0 - 2 Modelling Asset Content Types

Digital Assets in Digizuite are exposed in Optimizely as IContent of the MediaData variety. This means that they will automatically work alongside Optimizely's own media - and fit into any reference property meant to reference Optimizely Media. The integration comes prepackaged with a few default content type models, which enables it to work out-of-the-box. You can, however, also create your own ones to customize it even more.

Default Content Types

When installed, the integration adds three new media content types to Optimizely:

  • Digizuite Image (Digizuite.Episerver.Models.Media.Image) that holds any image assets. Inherits from ImageData and implements IDigizuiteImage.

  • Digizuite Video (Digizuite.Episerver.Models.Media.Video) that holds any video assets. Inherits from VideoData and implements IDigizuiteVideo

  • DigizuiteFile (Digizuite.Episerver.Models.Media.DigizuiteFile) that holds any other asset. Inherits from MediaData and implements IDigizuiteDocument

These default content types are used as a hardcoded fallback, when the Digizuite Content Provider tries to determine which Optimizely Content Type to return for a given asset. However, if you assign any other content model to an asset type in Digizuite, that will take precedence over these.

Extending existing media types

A simple way is to extend one of our default media types and add additional properties. In the example below we extend the image and add a custom blob image. In this case the image "quality" is named "Small" which corresponds to a specific media format in the DAM Center.

[ContentType(DisplayName = "Extended Digizuite Image", GUID = "0af71ce8-1e4b-499b-bf24-24e7fce44121")] [DigizuiteType(AssetTypeIds = new[] {GlobalConstants.AssetTypes.Image})] public class ExtendedDigiImage : Image { [ScaffoldColumn(false)] [DigizuiteMediaFormat("ImageSmall", "50036")] public virtual Blob Small { get; set; } }

Property Mapping

If you want to map a property in Optimizely to a metadata field in Digizuite that is not exposed through the default classes or interfaces, it's not very hard. Just like with the type mapping, you simply have to create the property in Optimizely and attach the "DigizuiteMetafield" attribute to it, indicating the name and the GUID of the metafield, that you want to map to it.

Property Mapping
[DigizuiteMetafield("Description", "C8BB4AF3-1598-4EA4-8D7A-98D54EEAD977")] [CultureSpecific] public virtual string Description { get; set; }

In this case, we want to make the field "Description" in Digizuite DAM usable in Optimizely.

The following Optimizely types are supported. Additionally, it is very important to map the Digizuite types to the correct Optimizely types. The table below shows the mapping between Optimizely and Digizuite types.

Episerver type

Digizuite type

Episerver type

Digizuite type

Bool

Bit

DateTime

DateTime

String

String, float, link, note, uniqueVersion, combovalue, editcombovalue

IList<string>

Tree, multicombovalue, editmulticombovalue

Int

Int

Blob mapping

As we know, Digizuite automatically produces a defined set of media formats for each asset. These media formats can also be exposed directly as Blob properties in Optimizely.

[ScaffoldColumn(false)] [DigizuiteMediaFormat("Image small", 50036)] public virtual Blob Small { get; set; }

This can be achieved by simply assigning the DigizuiteMediaFormat attribute to a Blob property in Optimizely.

A cool benefit of this is that by assigning a blob, due to Optimizely convention, you'll also get a pretty URL pointing directly to that media format, like this: "/globalassets/digizuite/155-las-vegas.JPG/Small" and we ensure the correct MIME type when requesting the asset.

Read more about asset URLs here: DFO 4.0.0 - 7 Customizing Asset Urls