Tuesday, March 25, 2014

Image Rendition and Blob Cache

I want to display my news in the Content Search Web Part. And use the one that displays 3 pictures on top and the text below them. But there are a few things I would like to change. One thing is to change the image size so that it fills the text area and still keeps the image in small size. To do this, I have to work with Image Rendition.

Under "Look & Feel" in the site administration, there is a setting called "Image Rendition". When click on that, it tells you that the blob cache is not yet configured:

Configure Blob Cache on the server:

Change the web.config file which is found in the inetpub folder for your site (similar path like C:\inetpub\wwwroot\wss\VirtualDirectories\80)

NOTE: Make a copy of the web.config before edit!

Go to the line that begins with “blob cache location"
Change the location attribute to specify a directory that has enough space to accommodate the cache size, typically a D or E drive (not the system drive!)
The size is expressed in gigabytes (GB), and 10 GB is the default. Do not set it to lower than that.
"BlobCache location="D:\BlobCache" path="\.(gif|jpg|jpeg|jpe|jfif|bmp|dib|tif|tiff|themedbmp|themedcss|themedgif|themedjpg|themedpng|ico|png|wdp|hdp|css|js|asf|avi|flv|m4v|mov|mp3|mp4|mpeg|mpg|rm|rmvb|wma|wmv|ogg|ogv|oga|webm|xap)$" maxSize="10" enabled="true"

Save the web.config file and the site will automatically recycle.

Now when you go back to “Image rendition” on the site, you can add a new item:

Give it a unique name, I just added the word “Custom” after and then set your own image sizes:

To see examples of how the rendition works, go to an Image library and select “Edit renditions” while hovering an image:

This will show how the image renders in the different ID’s:

Now I have to create a new Display Template for my Content Search Web part so that I can use this rendition, and that will be my next article.

No comments: