Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • Jeroen Breuer 4908 posts 12265 karma points MVP 5x admin c-trib
    Jan 07, 2016 @ 11:57
    Jeroen Breuer
    0

    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

  • Jon R. Humphrey 164 posts 455 karma points c-trib
    Jan 07, 2016 @ 12:27
    Jon R. Humphrey
    0

    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:

    • 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:

      <remove fileExtension=".svg" />
      <mimeMap fileExtension=".svg" mimeType="image/svg+xml" />
    

    This was based on the forum post: Selecting an SVG

  • Zukisa 2 posts 71 karma points
    May 17, 2019 @ 10:22
    Zukisa
    0

    Hi,

    I'm using Umbraco 7 and I'm unable to upload .svg files into the Media library in back-office.

    error when selecting svg files

  • Tyler Brown 62 posts 209 karma points
    Jan 08, 2016 @ 17:37
    Tyler Brown
    0

    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

  • Tajamal 87 posts 175 karma points
    Feb 24, 2016 @ 14:35
    Tajamal
    0

    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?

  • Mathias Poulsen 18 posts 139 karma points
    Mar 02, 2016 @ 14:48
    Mathias Poulsen
    0

    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.

  • Bipin Kataria 29 posts 60 karma points
    Jul 26, 2016 @ 02:17
    Bipin Kataria
    5

    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>

  • Saeed Hamed 1 post 72 karma points
    Apr 07, 2019 @ 06:22
    Saeed Hamed
    1

    My case was that i am unable to choose the svg file in content and your answer solved the issue, Many Thanks.

  • Osman Coskun 170 posts 404 karma points
    Sep 06, 2019 @ 06:48
    Osman Coskun
    0

    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.

  • Tomasz 22 posts 96 karma points
    Jan 30, 2019 @ 01:23
    Tomasz
    3

    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.

Please Sign in or register to post replies

Write your reply to:

Draft