Try our conversational search powered by Generative AI!

EPiServer 7 and SVG's

Vote:
 

Hi, the site I am currently working on makes heavy use of SVG's for images, there are lots of icons and illustrations in the site and using SVG's allows us to re-use images all over the place at different sizes without any loss of quality. I dont seem to be able to select one as an image for 'Url' field with a UIHint.Image. The media manager lets me upload one, but I just cannot select it. If I manually edit the path the SVG loads fine. Is there any where that I can set the allowed image types, or is there an alternative way to link to it?

Many Thanks
Dave

#72443
Jun 17, 2013 16:08
Vote:
 

Hi Dave,
In the past the "URL to image" property had a limitation to filetypes that episerver already defined.
Think that I had problem with tif support.
The "workaround" I get from the support was to use "URL to document" property.
Think you have to contact the support to check which filetypes that are allowed.

Magnus

#72474
Jun 18, 2013 13:16
Vote:
 

Thanks for your response magnus. I have tried using the UIHint.Document and that seems to do the job. Means the editor has to be a little more careful but I may be able to do some validation on file type when im rendering it.

Many Thanks

#72517
Jun 19, 2013 12:18
Vote:
 

Hey Dave,

As Magnus suggested the best way in EPiServer 7 in to use the URL to document since the system only handles predefined image types.

I will say that in the next version of EPiServer, the media system gets an overhaul and we've made it possible to define your own image types that can be handled by the UI.

#72529
Jun 19, 2013 16:21
Vote:
 

Thanks Ben, could you provide any more information as to how I would go about doing that? How does it differ from using UIHint.Document?

Many thanks
Dave

#72530
Jun 19, 2013 16:27
Vote:
 

In the next version of EPiServer files are also IContent. So you will add a content type which you can map to specific file extensions.

#72531
Jun 19, 2013 16:56
Vote:
 

Thanks for your assistance with this. In the end I just changed from UiHint.Image to UIHint.Document, I have lost a little validation on file types but it works fine.

Many Thanks
Dave

#73487
Jul 24, 2013 10:25
Vote:
 

Hi, 

I'm adding new media (*.svg) to my page, and all works fine, but it is not visible in Edit Mode; when I copy link to my *.svg from Edit Mode and open it in browser - I see "PreviewContainerPage.aspx" which says that "Preview is not available for this page". 

Is it because *.svg preview is not supported?

Thanks

#89517
Aug 19, 2014 10:41
Vote:
 

Assuming you are using EPiServer 7.5 or above then you can look at the following blog post Working with Media programmatically

Under the secton "Defining a media type" you can see that Johan creates a content type for images. On this content type is a attribute that specifies the file extensions of supported image files. If you add svg to this list then the UI should then work correctly. For example:

[ContentType(GUID = "0A89E464-56D4-449F-AEA8-2BF774AB8730")]
[MediaDescriptor(ExtensionString = "jpg,jpeg,jpe,ico,gif,bmp,png,svg")]
public class ImageFile : ImageData
{
    public virtual string Copyright { get; set; }
}

There may be a few quirks, for example the server is unable to generate a thumbnail.

#89976
Aug 29, 2014 13:42
This thread is locked and should be used for reference only. Please use the Episerver CMS 7 and earlier versions forum to open new discussions.
* 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.