1

All the images/resources for only a given template (say X) are stored in azure. While all other images are still stored in Sitecore Media Library.

When a user navigates to an item of template X in sitecore content tree, how can I tell sitecore to show the product image from Azure instead of Sql? Also, when the user is on an item of different template (not from template X) I still need the image from SQL.

Is it possible to have multiple media providers(sql and azure) and tell sitecore to bring data from different providers based on template of current item?

Or can we extend the default image type and add a new checkbox in the image type data type which says "Read from Azure" and use that to identify where to get the image from?

2
  • Is your media for these products already in Azure (or do you have some other way of transferring them Sitecore to Azure)? I previously wrote an integration with Azure that you might find interesting.
    – jammykam
    Commented Jan 16, 2017 at 10:34
  • The media for products is already in azure (some other independent migration job that loads media directly to azure without involving sitecore). Thanks for the link. Commented Jan 16, 2017 at 16:53

1 Answer 1

2

You can do this by overriding Sitecore.Resources.Media.MediaProvider.

In the GetMediaUrl you'll have access to the MediaItem to check the template or a field. You can then return either the base.GetMediaUrl (i.e. the Sitecore one) or build and return an Azure CDN link to the image/resource.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.