Custom DAM provider and thumbnails
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:
The method must return the thumbnail URL of the media content item. The URL of the asset is stored in
contentThe media content item stored in Sitefinity
thumbnailArgs The thumbnail related information – width, height, quality, etc.
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.
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 –
ProviderType - the type of the custom provider –
Title - the title of the configuration –
Description - some description of the configuration –
- Parameters - property of type
NameValueCollection which has the specific configuration values needed for the custom provider to work:
Here is sample implementation:
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
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.
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
- In the beginning of the template add:
- In the template update the part which displays the related images: