I would like to know what's the best way to handle svg files in Umbraco. It seems that when you try to upload svg as an Image Media Type you'll get an error: http://issues.umbraco.org/issue/U4-6008.
You could handle svg as the File media type, but than you don't get a thumbnail preview. I prefer to have svg as the Image Media Type because it's for a project which is already quite far and we're using the Image Media Type everywhere.
I can upload svgs to the media library and access the file in my document type via a media picker; however, this is not what you want as this a File Media Type, not an Image Media Type as you are already facing.
I'd be interested in following up on this if you do find anything out though?
James South might have some input based on his work with the ImageProcessor possibly?
Sorry I couldn't be more help at this time.
J
For future reference, I was able to add SVG to the Media Library by manually creating an SVG media type with the following properties exposed:
Name: SVG File
Alias: svgsrc
Type: Media Picker
and
Name: SVG Code
Alias: svgCode
Type: Textbox Multiple
In my web.config I've verified the svg mime type is present:
Looks like the image cropper does support SVGs so you could replace your umbracoFile alias on the image media type with a cropper. That will give you thumbnails in the backoffice. Is this what you are trying to accomplish?
On Umbraco 7.14.0 preview of svg files was working . After upgarding to 7.15.2 preview became the file name and a file icon.
Your solution solved the problem. Thanks.
Not sure if this is still relevant, but I managed to enable this recently in an Umbraco 7.6.1 project by removing the SVG from umbracoSettings.config line
Svg files in the media library
Hello,
I would like to know what's the best way to handle svg files in Umbraco. It seems that when you try to upload svg as an Image Media Type you'll get an error: http://issues.umbraco.org/issue/U4-6008.
You could handle svg as the File media type, but than you don't get a thumbnail preview. I prefer to have svg as the Image Media Type because it's for a project which is already quite far and we're using the Image Media Type everywhere.
Jeroen
Jeroen,
I can upload svgs to the media library and access the file in my document type via a media picker; however, this is not what you want as this a File Media Type, not an Image Media Type as you are already facing.
I'd be interested in following up on this if you do find anything out though?
James South might have some input based on his work with the ImageProcessor possibly?
Sorry I couldn't be more help at this time.
J
For future reference, I was able to add SVG to the Media Library by manually creating an SVG media type with the following properties exposed:
and
In my web.config I've verified the svg mime type is present:
This was based on the forum post: Selecting an SVG
Hi,
I'm using Umbraco 7 and I'm unable to upload .svg files into the Media library in back-office.
Jeroen,
Looks like the image cropper does support SVGs so you could replace your umbracoFile alias on the image media type with a cropper. That will give you thumbnails in the backoffice. Is this what you are trying to accomplish?
Tyler
I dont see it working when adding to document type. What you see is a small broken image with blue dot inside.
and image is not showing. i am styling my svg through css so its no go to use img tag.
any other good ideas?
Bump on this.
In my case we want to use Image Cropper everywhere instead of the media picker.
But when i upload the SVG image, initially it shows in preview, and it saves without errors.
However if i reload the node, the preview is gone and no data has been saved to my Image Cropper property.
If you want thumbnail in Media section for SVG file, just add below code in umbracoSettings.config > Content tag:
<imaging>
<!-- what file extension that should cause umbraco to create thumbnails -->
<imageFileTypes>jpeg,jpg,gif,bmp,png,tiff,tif,svg</imageFileTypes>
</imaging>
My case was that i am unable to choose the svg file in content and your answer solved the issue, Many Thanks.
On Umbraco 7.14.0 preview of svg files was working . After upgarding to 7.15.2 preview became the file name and a file icon. Your solution solved the problem. Thanks.
Not sure if this is still relevant, but I managed to enable this recently in an Umbraco 7.6.1 project by removing the SVG from umbracoSettings.config line
disallowedUploadFiles ...
Hope it helps.
is working on a reply...