Reputation: 83
I wish to upload SVG-icons to my blocks / pages in Episerver. However, I get the error "parameter not valid" no matter what type of svg I attempt to upload. PNGs work fine.
[MediaDescriptor(ExtensionString = "svg")]
public class SvgIcon : MediaData
{
public override Blob Thumbnail
{
get { return BinaryData; }
}
}
}
Here is the class based on this article that ive tried to use: https://mariajemaria.net/another-failed-svg-upload
Any suggestion as to how to potentially ignore these "parameters"?
Upvotes: 0
Views: 197
Reputation: 7401
I think it's because you're missing a ContentType
attribute?
I usually do something like the following:
[ContentType(DisplayName = "SVG Image", GUID = "42b1b1b3-450f-4c29-93f7-f98fdfb6fbb1")]
[MediaDescriptor(ExtensionString = "svg")]
public class SvgImageData : ImageData
{
public override Blob Thumbnail
{
get { return BinaryData; }
}
}
The GUID
property can obviously be any valid GUID, but it's good practice to always include one.
Upvotes: 1