Press Ctrl / CMD + C to copy this to your clipboard.
This post will be reported to the moderators as potential spam to be looked at
In Umbraco 8.5, I want to include the content of image media items of type SVG directly in html markup inside of a partial view with @Html.Raw(...)
What is the best way to retrieve the content of the media items so the data is properly cached?
This is what works for me right now:
but this seems to be not cache-friendly.
Do you want just render SVG to page's DOM?
thank you for taking the time to answer. I want to be able to modify part of the svg tags prior to rendering, this is why I am looking for a server-side, cache-friendly solution to this.
The problem with code you use is IO library, the slowest part is reading the file from the disk.
I would recommend you just add caching to the Partial level for example, it's super easy to do with Umbraco helper Html.CachedPartial
great to hear from you. Thank you for pointing out the obvious to me! :-)
I was suspecting that there might be a better "Umbraco" way to get to the svg content apart from using the IO library, but keeping this code and caching the partial is a great idea. Thanks again.
is working on a reply...
Write your reply to:
Image will be uploaded when post is submitted