SVG images in Media Library

Thomas Seyssens asked on June 3, 2016 14:07

Hello,

We're making a website that uses SVG images for high quality icons. These icons should be placed in the Media library to make sure the user can select the icon they want for the specific item. However, after configuring web.config and allowing the media library to upload svg items, it uploads, but does not show the svg-image. If i call for this image in the item, it's not rendered. When i go to the direct link, it downloads the image directly instead of showing it.

Any solution for this particular problem?

Recent Answers


Jan Hermann answered on June 6, 2016 13:33

You can append the ?disposition=inline query string to your getmedia url to tell Kentico to set disposition header to inline to let browsers to try render them instead of offering them for a download. Then it depends on your IIS configuration and your browser's configuration however the image should be rendered in the window. Moreover, the url to the svg file is usually part of the img tag and as such it should be rendered no matter of what disposition you set in the header.

0 votesVote for this answer Mark as a Correct answer

Dmitry Bastron answered on August 8, 2016 12:02

Just add a new line into the ~/CMS/App_Data/mimetypes.txt

svg,image/svg+xml

And either re-upload your svg files to the Media library or fix FileMimeType field into the Media_File database table for existing svg files.

0 votesVote for this answer Mark as a Correct answer

   Please, sign in to be able to submit a new answer.