Custom DAM provider and thumbnails

Overview

You can add custom DAM providers if you want to integrate Sitefinity with a provider that is not supported out of the box.

The custom DAM provider must inherit DamBlobStorageProviderBase class. It has one abstract method that needs to be implemented: string GetItemThumbnailUrl(IBlobContentLocation content, ThumbnailArgs thumbnailArgs). This method has two parameters:

  • content
    The media content item stored in Sitefinity
  • thumbnailArgs
    The thumbnail related information – width, height, quality, etc.
The method must return the thumbnail URL of the media content item. The URL of the asset is stored in content.FilePath property and must be updated according to the other parameter – thumbnailArgs considering the specifics of the DAM provider that you want to integrate with.

Sample implementation

Here is sample implementation of custom provider:

Each provider must have its corresponding configuration. The configuration class must implement IBlobStorageConfiguration interface. There are two methods that must be implemented.

The first one is IEnumerable<DataProviderSettings> GetProviderConfigElements(ConfigElement parent) as the assets are stored and managed by the DAM provider this one must return empty list so its implementation must look like this:

The other one returns the configuration type of the provider. Then this configuration type will be added to the collection of all blob storage configurations - IEnumerable<BlobStorageTypeConfigElement> GetProviderTypeConfigElements(ConfigElement parent). It returns enumerable of type BlobStorageTypeConfigurationElement. An object of that type needs to be created (in the constructor pass the input parameter parent) and return an enumerable containing only that object. The properties are:

  • Name - the name of the custom provider – CustomDamProvider
  • ProviderType - the type of the custom provider – typeof(CustomBlobStorageProvider)
  • Title - the title of the configuration – CustomDamBlobStorageTypeTitle
  • Description - some description of the configuration – CustomDamBlobStorageTypeDescription
  • Parameters - property of type NameValueCollection which has the specific configuration values needed for the custom provider to work:

Here is sample implementation:

Where:

  • ScriptUrlKey is required for the integration to work. The script hosted on the specified URL will be loaded into the application in runtime and will load and open the assets selector of the DAM provider.
  • SupportedThumbnailFormatsKey is optional parameter which defines what are the allowed extensions for the thumbnails.
  • CloudNameKey is parameter specific for our custom DAM provider and is required for opening the assets selector.
  • ApiKeyKey is parameter specific for our custom DAM provider and is required for opening the assets selector.

After the provider type and provider type configurations are implemented, the configuration must be registered to Sitefinity. You can do that by attaching to Bootstrapped event on Application_Start:

After the configuration is registered in Sitefinity you will be able to create the custom DAM provider by opening Administration » Settings » Storage providers » Add storage provider. The custom provider should be listed in the Provider type dropdown.

Custom thumbnails

You can choose from all (default and custom) thumbnail profiles for related images field if that image comes from DAM (Digital Asset Management) provider.

Here are the modifications that must be applied in the template

  1. In the beginning of the template add:
    @using Telerik.Sitefinity.Modules.Libraries;
  2. In the template update the part which displays the related images:

Want to learn more?

Sign up for our free beginner training. Boost your credentials through advanced courses and certification.
Register for Sitefinity training and certification.

Was this article helpful?