Updated Existing Pipeline to Upload image in Azure blob

 We are uploading the media items in azure blob, after user uploads image sitecore. We are storing the url value in CDN file path field in Sitecore.


Step 1 : First we have to create media item templates under our current site. It should inherit the standard sitecore media item template. The path of standard sitecore media item template : /sitecore/templates/System/Media/Unversioned/



We inherited one more base template _baseMediaExternalPath and it has the field CDN file path. It is used to store image url in azure blob. The reason for creating custom media template, each media item should have the CDN file path field.



Step 2 : Then we have to create config file to update existing pipeline. It will patch(run) the processor, after uploaded image has been saved in sitecore.


We have mentioned custom class file path, Name, Path (sitecore media library item) and list of templates, we want to update template of the new media items accordingly. It indicates, basically sitecore will create image item by using default media template. We are just overriding to update custom media template because the each media item should have CDN file path field. Also, our custom media template inherits sitecore default media template. Each templates has Old and New mapping.

Step 3 : We have to create class file to write the logic for upload image in Azure blob after the images has been saved in sitecore.

Path of the class file : Cirrus.Foundation.SitecoreExtensions.Processor.UploadToAzure

Here, we written the logic to update New template by checking Old template id. Also, we are updating the value to CDN file path field.


Step 4 : The media item should be like below,
,


Step 5 : We should declare the Azure blob related details in config file. It is environment specific. These configuration will get initialized when processor invokes custom class file.


Comments

Popular posts from this blog

Email Experience Manager (EXM)

Federated Experience Manager (FXM)