This project is read-only.

SVG support in media library

Topics: Customizing Orchard, Writing modules
Mar 1, 2015 at 6:04 AM
hi, i uploaded some svg images, but the images don't show properly in media library. it only displays a file icon.
any idea how to show the svg image?

Mar 1, 2015 at 6:32 PM
Edited Mar 1, 2015 at 6:33 PM
I think you need to add a proper mime type map to your root web.config file (inside of the <system.webServer> element. Try this:
   <remove fileExtension=".svg" />
   <mimeMap fileExtension=".svg" mimeType="image/svg+xml" />
Mar 2, 2015 at 6:22 AM
it works for newly uploaded svg. thx skywalker.
Mar 24, 2015 at 12:05 AM
I did this on a fresh install from the Azure Webpage Gallery:

  • Created a new site in the gallery, named it "FallowOrchard"
  • Downloaded new site via WebMatrix
  • Opened WEB.CONFIG in the root of the project, added the above snippet immediately following the <system.webServer> marker, and saved the changes
  • Opened the dashboard, created media folder named "SVG" and imported five SVG files (from the "Branding" folder of Inkscape)
  • Published the site to Azure
  • Five generic icons on both local and Azure sites
  • Verified above snipped was in the root WEB.CONFIG file
  • Stopped and started the site both locally and on Azure
  • Added more SVG files to "SVG" folder
  • Inserted one of said SVG files into the "Welcome to Orchard" via TinyMCE and published the file
  • Published the site to Azure
  • More blank icons in the media manager
  • A "Download" icon in the "Welcome to Orchard" page, which leads to a nice SVG of a tiger
Does anyone have any ideas as to how to get SVG support in Orchard? Is this going to be supported "out of the box" in the future?