Monday, April 22, 2013

How to Render Image Extension

Hello Friends,

While working with Sitecore we all would by now been familiar with the extension '.ashx'. This is the extension by which Sitecore normally renders all its media items.

Now I came across  query wherein I was asked as to is it possible to render images or other media items in their original extension (e.g. '.jpg', '.png', etc)

Well this query made me to search those options from this is being managed and my search landed me on the web.config file. Within web.config you would find the below mentioned snippet -

  MEDIA - REQUEST EXTENSION
The extension to use in media request URLs.
If the value is not set, the Extension field of the individual media items will be used (ie. JPG, GIF, etc.)
Default value: "ashx"

< setting name="Media.RequestExtension" value="" /> 


If the 'Media.RequestExtension' value is left as blank in that case the the extension of the media item would be used but if we have set its value to Default value then the Default value would show up.

I did test it with latest Sitecore version but need to see if lower versions too support it. 



No comments:

Post a Comment