Try our conversational search powered by Generative AI!

Could not add an SVG image with ImageGalleryHandler

Vote:
 

I am using ImageGalleryHandler to save the Image in the system. It works fine for image files (.jpg, .png etc.) However, it does not let me to add an SVG image to the system.

I have used the AddImage(Image) to add the image.

EPiServer.Community.ImageGallery.Image newImage = new EPiServer.Community.ImageGallery.Image(imageGallery, imageName, description, author,
                    fileInput.PostedFile.InputStream)

{
                    Status = status,
                    LanguageID = languageID
};


newImage = ImageGalleryHandler.Instance.AddImage(newImage); //Throws FrameworkException for SVG images

When debugged I am getting this from FrameworkException (Screenshot) - https://1drv.ms/u/s!Ao3_PEzak8vNlU3KZiOeBNum9a81

It says "Image file could not be read, this could be because the file is corrupt or in an unsupported format"

I am sure that my file is not corrupted. And is this true? Are the SVG files not supported?

#196981
Edited, Sep 19, 2018 6:30
Vote:
 

You have to add support by your self. You can find code in this blog: https://world.episerver.com/blogs/Ben-McKernan/Dates/2015/7/supporting-svg-images/ :)

#197057
Sep 20, 2018 11:57
* You are NOT allowed to include any hyperlinks in the post because your account hasn't associated to your company. User profile should be updated.