Copied to clipboard

Flag this post as spam?

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


  • Danine Noble 8 posts 97 karma points
    Sep 15, 2021 @ 21:52
    Danine Noble
    0

    SVG Media Not Rendering on Cloud

    Evening all ^^ I was playing around with a Cloud Trial and everything was working fine last week but now on 8.16 it's suddenly having problems rending media.

    Exception:
    System.IO.FileNotFoundException: Could not find file 'C:\home\site\wwwroot\media\crhay4b2\nws.svg'.
    
    File name: 'C:\home\site\wwwroot\media\crhay4b2\nws.svg'
    

    It works locally no problem, but on Cloud I get the error above. And what I see in the Cloud is this: enter image description here

    It can't find the path even if it's uploaded on the Cloud itself so it's not just a media transfer issue. I have tried restarting the environment, did not change anything.

    Any help would be appreciated.

  • Danine Noble 8 posts 97 karma points
    Sep 15, 2021 @ 23:43
    Danine Noble
    0

    Update:

    Was able to confirm this is only happening with trying to render SVGs, and I'm suspecting it's to do with attempting to write it inline. This code was working on a trial Cloud project two days ago and nothing with it has been changed since.

    System.IO.File.ReadAllText(Server.MapPath(Model.SiteLogo.Url()))
    
  • Dave Woestenborghs 3342 posts 11278 karma points MVP 6x admin c-trib
    Sep 17, 2021 @ 06:55
    Dave Woestenborghs
    0

    Hi Danine,

    You probably need hostingenvironment.mappath.

    Dave

  • Danine Noble 8 posts 97 karma points
    Sep 17, 2021 @ 14:16
    Danine Noble
    0

    Thank you Dave ^^

    I gave it a try but I still receive the same error on the Cloud environment. Gave it a restart just in case but still stuck with it working locally but not working on Cloud.

    What is the best way to render SVGs inline? Everywhere I look it's basically the snippet I have above.

    Also noticed that the trial Cloud project that it was working on was 8.15 and this one that's having problems is 8.16.

  • Danine Noble 8 posts 97 karma points
    26 days ago
    Danine Noble
    100

    Confirmed with Umbraco that the mapPath way of getting SVGs rendered inline doesn't work with Azure Blobs. I could really use some help figuring this one out. I have no experience with blobs or doing much outside of frontend ^^;

    I found this thread, render svg file from media center, but I haven't been able to get anything to render at all. Could someone point me in the right direction?

    Currently I'm passing in the media item and then trying to use media.Url with UrlMode.Absolute, then giving that path to the stream. It's getting the path of the media item but fails to open the stream.

  • Danine Noble 8 posts 97 karma points
    25 days ago
    Danine Noble
    0

    Ah! A fresh morning start and I realized my error: url absolute xD

    Everything works once I changed that. The thread linked above is perfect.

Please Sign in or register to post replies

Write your reply to:

Draft