Copied to clipboard

Flag this post as spam?

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


  • Sten Hougaard 12 posts 84 karma points
    Aug 19, 2015 @ 10:41
    Sten Hougaard
    0

    SVG images not showing in media library?

    Hi,

    I have tried to add a SVG file to the media library in Umbraco using the upload feature, however nothing happens: No errors, no file uploaded..

    I would expect that handling SVG to be standard in a modern CMS like Umbraco. Is there a package I need to add to my solution?

    Also adding multiple media files does also not seem to be handled in a standard Umbraco solution (?).

    /Sten

  • Dennis Aaen 4500 posts 18255 karma points admin hq c-trib
    Aug 19, 2015 @ 11:27
    Dennis Aaen
    101

    Hi Sten,

    If you go the /Config folder of your Umbraco installation, then you will find the umbracoSettings.config.

    If you open this file you will find the below configuration.

    <!-- These file types will not be allowed to be uploaded via the upload control for media and content -->
               <disallowedUploadFiles>ashx,aspx,ascx,config,cshtml,vbhtml,asmx,air,axd,swf,xml,html,htm,svg,php,htaccess</disallowedUploadFiles>
    

    Just remove the file extensions that you will allow the user to be able to upload.

    Hope this helps,

    /Dennis

  • Sten Hougaard 12 posts 84 karma points
    Aug 19, 2015 @ 14:46
    Sten Hougaard
    0

    Thank you Dennis - That helped :-) Now all I need it a preview of the file in backend :-)

    SVG files can be inserted in HTML just as say PNG or JPG, simply by adding a link to the source, so the Umbraco backend should be able to offer a preview, as it does for other image file types.

    Like the Umbraco Logo here on our.umbraco.org it is rendered using SVG:

    https://our.umbraco.org/assets/images/logo.svg

    Our Umbraco LOGO

    /Sten

  • Dan Diplo 1554 posts 6205 karma points MVP 6x c-trib
    Aug 19, 2015 @ 18:29
    Dan Diplo
    0

    I agree, SVGs are being used more and more so should be rendered in the backend. Should be particularly easy to generate a thumbnail of, too :)

  • Sten Hougaard 12 posts 84 karma points
    Aug 20, 2015 @ 06:35
    Sten Hougaard
    0

    As SVG is Scalable Vector Graphics you really do not need to "generate" a thumbnail. All you need to do is add a width (and perhaps height) attribute to the the IMG tag showing the preview. You could even just add a class to it "thumbnail" for instance than then scale it using CSS:

    .thumbnail { width: 200px; }

    /Sten

  • Dan Diplo 1554 posts 6205 karma points MVP 6x c-trib
    Aug 20, 2015 @ 19:42
    Dan Diplo
    0

    Yeah, I know Sten - that's why I said it was easy to generate a thumbnail - you literally just change the width and height and it scales :)

  • Bipin Kataria 29 posts 60 karma points
    Jul 26, 2016 @ 01:39
    Bipin Kataria
    2

    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>

  • Dan Diplo 1554 posts 6205 karma points MVP 6x c-trib
    Jul 26, 2016 @ 07:47
    Dan Diplo
    0

    Great tip, Bipin - I can confirm that works!

  • Bojan 16 posts 131 karma points
    Aug 08, 2016 @ 10:30
    Bojan
    0

    The thumbnail preview only works if you have already uploaded all SVG images to the media section. If you leave <imageFileTypes> with SVG option, then when you try to upload an SVG again, Umbraco will try to get image dimensions and will throw an exception.

    So currently, you can have SVG images without thumbnail preview in the media section and it will be served as File type, not Image type.

    We are waiting for the proper final solution for this, hopefully soon :(

  • Alex Skrypnyk 6150 posts 24110 karma points MVP 8x admin c-trib
    Aug 17, 2016 @ 16:43
    Alex Skrypnyk
    1

    Hi Bojan,

    SVG preview already works in Umbraco 7.5

    http://issues.umbraco.org/issue/U4-8580

    Thanks,

    Alex

  • Carina 12 posts 73 karma points
    Aug 30, 2016 @ 06:32
    Carina
    0

    Hi, I've installed v7.5.2 but still getting the same issue as @Bojan. If I take out the

Please Sign in or register to post replies

Write your reply to:

Draft