A website without media is more like a home without furniture.
Every website needs good media to make a website look more attractive. And with the help of media files, users can also easily understand concepts without even reading the content. Right?
So let’s talk about Media Library Concept in Sitecore.
Media Library is a place where you can store your media files whether it is an Image, Video, or Document.
In the Media Library, you can:
After login in Sitecore, you will see this type of tree structure, where you will find the “Media Library” folder. Here you have to upload your media assets like image, video, document etc.
There are three ways to store Media Files in Sitecore.
Store Media File into Sitecore Database:
This is the default option to store the media files in Sitecore. When you upload any media file it will be stored in the Sitecore database. When you Delete the item from the media Library it will be deleted from the DB as well. Once you delete it there will be no any clue of having that file.
Store Media File in File Storage / Store Media File as Physical location:
Sometimes there is a requirement to store the file physically instead of through databases. That’s why Sitecore has also provided this functionality to store media files physically. This is not the default functionality but you can enable this feature by making some changes to Sitecore.config.
Note: If you are storing Media files as physically and if you are deleting media items from Sitecore the physical file will not be deleted. Also, if you are deleting the file from a physical location your media item will not be deleted from the Sitecore Media Library.
Store Media File in Azure Blob Storage:
In Sitecore, all the media items are stored in the database as opposed to being saved in the file system and this is by default. You can also use the Azure blob storage module for storing media instead of the database.
Below blog link to Enable the Azure Blob Storage module for Sitecore blobs: https://doc.sitecore.com/xp/en/developers/103/sitecore-experience-manager/enable-the-azure-blob-storage-module-for-sitecore-blobs.html
Now the questions are:
If we are deleting the media library assets, will they also get deleted from Azure Blob?
No, that will not happen. Although, the orphan blobs can be deleted from the Sitecore XP: (Control Panel > Administration tools > Database Cleanup > Database Name > Cleanup Blobs > Execute Cleanup)
In the future, if we don’t want to continue with Blob Storage then can we migrate the Media Items to the Database?
Yes, you can use Blob migration tool. Use the blob migration tool
Can Azure Blob utilize the CDN that is provided by Managed Cloud Service to serve its assets?
Yes, CDN is supported. Compatibility defined on the Sitecore XP level, not on media source. You can also manually configure the Sitecore Media Library for using the CDN The "Media.AlwaysIncludeServerUrl" and "Media.MediaLinkServerUrl" settings, media resources will directly point to CDN. The "Media.AlwaysAppendRevision" setting, and new updated media will have an updated URL, thus URL-based caching mechanism of a CDN working.
As per the above explanation, I hope you can choose the better options to store your media assets.