February 17, 2011

Adding custom icons for the media library

If you need to have some custom icons in the media library you have several options:
  • Install the corresponding program on the computer and associate the file with this program (ie: acrobat reader for .pdf files). This option is maybe not an option for the production server.
  • Associate the file extension in the operating system. Open "Control Panel -> Folder Options-> File Types -> New -> Add file Extension" then register the icon for this extension (Advanced -> Change Icon)
  • Associate the Icon with the file extension in your web.config. Add thumbnails generator for the known file type. For example for PDF file type:
    <mediaType name="PDF file" extensions="pdf">
        <generator type="Sitecore.Resources.Media.MediaThumbnailGenerator, Sitecore.Kernel">
        <staticFile>Path where the icon is located. For example /sitecore/shell/Themes/standard/images/pdf_icon.png</staticFile>

After these modification, clear the cached files:
  1. Open the folder "/Temp" under the Sitecore root.
  2. Delete all files with the name "fileicon.....".
  3. Clear media cache "/App_Data/MediaCache" under the Sitecore root.

1 comment: