May 29, 2013

Image Renditions in SharePoint 2013

There is a new cool feature introduced in 2013 called Image rendition, which is very helpful to the content writers to crop or resize (technically ‘Optimize’ J ) the images on the fly. In 2010 there was no such kind of feature to change the image sizing through the UI. For this we used to approach the designers. But with this Rendition feature in 2013, we can resize/crop the images in a simple way.
This feature improves the user experience for the sites by optimizing the images. The original (actually uploaded) image will be saved in the site and you can use different scaled sizes of the image throughout the site.
This will be very helpful when posting content, writing blog posts and developing mobile applications which has images.
These are the prerequisites to enable this feature
1>     Enable the Blob Cache for the webapp where you need this feature
2>     Publishing Feature must be enabled(if your site is not using publishing template)
Here I am taking the publishing portal to show you this. (so my 2nd prerequisite is done)
Enabling the Blob Cache:
The dynamic changes in the images affects the performance of the application, internally the image rendition capability depends on the Blob Cache to cache the renditions. So to work this feature perfectly without any performance impacts, enable the blob cache for your web application.
For this go to the web.config of your webappplication and make sure that Blob Cache is enabled like here
Now go to the site settingsàSelect Image Renditions under Look and Feel Category
You will find some of the predefined renditions like this
You can edit, delete these existing or you can create the new rendition.
So now let’s have a look how these works,
Upload a picture in to the image gallery and click on the … symbol to open the menu. And then select the Edit Renditions
Then you can see the image with different renditions (The default four renditions)

Now, I am editing the third “Display Template Picture On Top” rendition. By default it has 300x100 in size. I am cropping the image to show only bottom portion like this.

So we have edited the image (here I have cropped it, you can set the size by creating the new rendition too). So now use this on the page.
I have created a page and inserted my uploaded (original) image on to it.

Now, I am selecting the third rendition (which we modified earlier i.e “Display Template Picture On Top”) .So the image changes to its scaling, like this

And save it.

Some other information about renditions:
·         This rendition is not only for images, this can be used with videos too.
·         It supports lot of image and video types(like jpeg, png, wmv ,avi etc)
·         All the image rendition information you can see at 
·         You can programmatically do the renditions using the ImageRendition and ImageRenditionCollection classes.
·         When we use an rendition for the image, SharePoint will append an Rendition ID to the image url, which will be used to load the renditioned image instead the original image on to the page when requests it.

This is all about Image Renditions...!
Thank you.

No comments:

Post a Comment