Have you analyzed your Sitecore media library?
Not yet? This is the time to look your media library size, unused item etc.
Media library consumes more space in term of size and increase the volume of Items in sitecore tree, and over the period of time, it might have not used any more, thus we should clean up these Media library Items as these Items are not being used/referenced in any other content item in the Sitecore.
I got the same assignment, I had to clean up the media library in my project, so I analyzed the current media library folder and below is the summary:
I also wanted to capture the additional information when I ran the custom utility for Analysis my media library items,
- Media Item ID
- Media Item Name
- Media Item path
- Total Media Library Item Count
- Unused Media Library Count
- Uploaded Date
- Size of Individual Media Item
And also on the basis of this report, they can decide which Media item need to be delete or not?
In my case, below are the conditions for deleting the media library items
- Media item must be unused means not referenced with any content item
- Uploaded date should be older than 3 month
- Size of the media item should be more than 1MB
So,I have created one #Sit
ecore module called "Medi aLibraryAnalyzer" which is responsible
for the analyzing and cleanup of the media library.
Below are the functionalities of the MediaLibraryAnalyzer Module
- Provides the user experience UI, where we can select the multiple input parameters, for example database name, Media Library Folder Path, Log File Path.
- Provides the summary of the media library folder like Total media Item Count, Total Media Size, Total Unused Media Count, Total Unused Media Size, Total used Media Count, Total used Media Size
- Provides the list of unused media item which contains various attributes like ItemName, Path, Media Type, Item Size, Created date, Modified date.
- Filter the records based on created date to and from, media type, size
- Capability of archiving the unused Media Item, we can select the unused item and can move to a specific folder
- Searching and paging the Media Item.
Below are the some Screen shot of the MediaLibraryAnalyzer Module
Summary of the media library
Filter the result based on several parameters
Move the un-used items to other folder:
Download the module:
How to use this Module:
- Enter the URL your Sitecore instance name /Admin/MediaAnalyzer.aspx
- Select the database where you need to run this utility
- Enter the correct media folder path
- Enter the Log file path for logging and make sure permission is being provided
- Press on Go Button >
- All the un-used media item list will be listed
- Click on Filter button >> further filter the result based on providing parameter like media type, size, created to and from the date.
- Filter result will change in the text changed event
- You can select multiple item and can perform 2 operation, whether delete it or move to another folder.
- For delete the unused item, just select the items > press the Delete the selected item button
I hope this article will help you to analyze and cleanup the media library.
If you have any questions or concerns, please get in touch with me on Twitter @sitecore_ashish or on Slack).