Copied to clipboard

Flag this post as spam?

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


  • Deepak 3 posts 93 karma points
    May 26, 2021 @ 15:37
    Deepak
    0

    How to display SVG images? (currently displaying broken images on website)

    Hello all,

    I'm having an issue where SVG files are displaying a broken image on the front of our website.

    I can upload them as 'Images' or 'Files' through the media tab just fine and when I put them on a Rich Text Editor they are showing up on the umbraco interface - but when I save and publish, the corresponding webpage displays a broken image (regardless of 'Image' or 'File' type).

    I've tried adding the following code to the umbracoSettings.config:

    <imaging>
      <imageFileTypes>jpeg,jpg,gif,bmp,png,tiff,tif,svg</imageFileTypes>
    </imaging>
    

    Which didn't work.

    Let me know if there's any more details I can provide to help diagnose the issue.

    Any help is much appreciated!

    (using Umbraco 7.13.2 btw)

  • Søren Gregersen 441 posts 1884 karma points MVP 2x c-trib
    May 26, 2021 @ 17:35
    Søren Gregersen
    0

    Hi,

    Can you give examples of the output, working and non-working if possible :)

  • Brendan Rice 538 posts 1102 karma points
    May 26, 2021 @ 17:40
    Brendan Rice
    0

    Have you got the svg mime type added to the web.config? enter image description here

  • Deepak 3 posts 93 karma points
    May 27, 2021 @ 12:24
    Deepak
    100

    Thank you for your responses - after delving deeper with coworkers we've determined the issue was with my local umbraco looking for the uploaded image file in the wrong place. like this: enter image description here So we tried JPGs and JPEGs which resulted in a similar console error: enter image description here Clearly there is some trouble with my local umbraco website keeping track of the images, but this isn't really an issue because our live site is able to do this fine.

    So I walked through the process with our editor to see the exact issue - it turns out the drag and drop was not uploading the svg correctly (I think it was automatically uploading it as a 'File') but going through the 3 dots and uploading as 'Media' file makes it work just fine on our live site! enter image description here I previously tried the following:

    • Making sure svg is not in the 'disallowedFileTypes' tag in umbracoSettings.config
    • Adding the .svg mimeMap code to the web.config as suggested above
    • Adding 'imageFileTypes' tag in umbracoSettings.config with svg inside it
    • Adding 'allowedFileTypes' in umbracoSettings.config with svg inside it

    I don't think it was solving the issue because of how media is being handled and kept track of by Umbraco on my local - but I'm gonna try these methods now to see if they allow me to drag and drop the 'media' file type because that should make life a lot easier for our editor.

    whew - so the issue is pretty much resolved - I hope my ramblings are somewhat clear and hopefully might be able to help some one in the future if they run in to a similar problem.

    Also, for your reply Søren, this is what I was seeing: enter image description here Then the front end: enter image description here

  • Deepak 3 posts 93 karma points
    May 27, 2021 @ 14:20
    Deepak
    0

    Also,

    -Adding 'imageFileTypes' tag in umbracoSettings.config with svg inside it

    allows me to drag and drop the svg files as 'Media' type - so hopefully that makes life a bit easier for our editor

Please Sign in or register to post replies

Write your reply to:

Draft