For the life of me I cannot retrieve an SVG (Vector Graphics (SVG)
) in my views/models. I have created a picker (using Umbraco.MediaPicker3
) with no restrictions. I have attached it to my document type.
I can create a content node, and pick a JPG. Works fine. Pick a PDF? Works fine. These all return a MediaWithCrops
object. Pick an SVG? Returns null.
I can’t see any documentation about treating SVG differently. Any hints? The picker shows the SVG preview correctly:
If I do something like this:
var entry = (MyCustomModel)Model.Content;
var icon = entry.Icon;
var sourceValue = Model.Content.GetProperty("icon").GetSourceValue();
I can see for a random media entry (PDF in this case):
And if I try the same again with an SVG, icon is now null
but there is a SourceValue
present:
This is a companion discussion topic for the original entry at https://our.umbraco.com/forum/110560-media-picker-with-svg-in-umbraco-10