We have noticed this many times that the sites created by SharePoint content owners using images are way too large for web consumption. The reason behind this is very easy to understand. Let us take an example.
One of our clients gets a high-resolution, meant-to-be-printed image from the marketing department. He uploads that image to the SharePoint by using a resize tool from the ribbon control. Though he was trying to adjust the height and width of the image to make the page look nice, he fails because the resizing does not really help to make an image size smaller. If he uploads the image somehow, the problems will arise for mobile users who use slow internet connections. They will have to wait for a long time for the image to download.
The solution to this problem is in image rendition, a SharePoint Server publishing feature, that comes in SharePoint since SharePoint 2013. With this amazing feature, the addition of images to a library has become easy and you can add them with your desired height and width without having to download the image.
You require a few things to use the image rendition feature.
- Ensure that the Publishing feature is activated on your SharePoint Server site
- You need a picture library to test. You can always create a new picture library in Settings > Site contents > Add an app or use the default library.
- Turn on the Blob caching in your web.config file.
The above steps are very easy to figure out so there is no need for an illustration. Furthermore, to turn on the Blob caching, just go to the SharePoint web.config file located on the physical server. The web.config file is generally located in the same directory as C:\inetpub\wwwroot\wss\VirtualDirectories\80. If that sounds tricky, then you can use IIS to find the directory. Go to web.config (open with an editor like Notepad) (once you click on Save, SharePoint site will be reset by IIS, do not do this on production during peak hours) and use Control-F to find the first case of “<BlobCache”. In this line, you will get to see enabled=”false”. Just change this to “true” and click on "Save all".
Subsequently, you can personalize the image-rendition sizes by navigating to Settings > Site settings > Look and Feel > Image Renditions. You can use the few predefined sizes there. To personalize your image, just hit on Add new item, enter a name, set width and height, then hit on Save. Subsequently, when you insert the images to a picture collection, you will have a rendition that matches the size that you can personalize.
To go further with the process of image rendition, go to the picture library and upload your desired image. Once the thumbnail of the image appears in the library, hover the mouse pointer over it and hit the ellipsis that appears in the bottom right. Then, hit "Edit Renditions".
Afterward, you will see all the available renditions in the form of a list and the image will appear as created already in different sizes. From "Click to change", you can edit the cropping and sizing of the rendition. This will come up as a dashed box that is controlled to the size of image rendition; from here, you can resize and move photos accordingly so that the image appears in the best possible way.
Once you are done with image rendition setup and configuration, you can choose from several size options while putting images on the publishing page. Subsequent to inserting the image and editing a page, just click the image tab from the ribbon and then select choose from the pick rendition dropdown.
As image rendition is in use in the illustration, it can be downloaded quickly. The image is actually 140px/140px, but when it comes to access, it will load in no time. Sounds cool, doesn’t it? If you want to reference the image rendition directly using code or without the ribbon then you can pass URL parameters to the image for either the RenditionID.
For instance, in the illustration below, the raw image URL in SharePoint was:
http://sp15/PublishingImages/1012858_10152057897829676_916248115_n.jpg
If I want to load the image rendition for 304×100, I can reference the image like this:
http://sp15/PublishingImages/1012858_10152057897829676_916248115_n.jpg?Width=304&Height=100
You can allusion an image with the height or width also, however, if there are manifold matching renditions, the first will come again.
Image rendition is surely a handy characteristic for assisting content authors to design images that are web-friendly. This rendition is also available for videos too.