Wednesday, March 15, 2017

How to use Image Renditions in SharePoint

Hi Friends,
In this post we are going to learn What are the Image Renditions and how we can use it in SharePoint.

Image renditions helps to display a single image into various sizes based on our needs. Apart from choosing size, it also allows you to crop the image while adding it to the publishing page.

So based on our needs, we can display abcd.jpg as Logo, Banner and Thumbnail etc., This technique helps in reducing the size of the file that is downloaded to the client, which then improves site performance. You can find some of the ways to improve SharePoint site speed and performance here.

The other advantage if you notice, we need not to create different sized images i.e., one for logo, one for thumbnail etc.,. With Image renditions we can display a single image into multiple sizes.

Below are the prerequisites for using Image Renditions 
  •  Publishing Site
  • BLOB Caching enabled(Follow this link on how to configure BLOB cache and its uses)



Please find the below steps on how we can configure Image Renditions.

1.     Go to the top-level site of the publishing site collection.

2.    Choose the Settings icon. On the Site Settings page, in the Look and Feel section,  choose Image Renditions.

3.    This will show you list of available Image Renditions available on this site. We can  modify the existing one, Or we can even create our own based on required dimensions.



          4.       ID indicates the RenditionID. We will be using this RenditionID as a parameter to                       specify the dimensions of an image we need.

         5.       If we want to construct image URL directly from the RenditionID, we just need to                  add it as a  Query String.

Examples: If we want display abcd.jpg as 100*100 on a page, then my image source URL will be “abcd.jpg?RenditionID=1
If we want display abcd.jpg as 200*200 on a page, then my imgage source URL will be “abcd.jpg?RenditionID=2”

        6.       If we want to insert the image in the page content then follow the below steps. 
a)     Edit the page and place the cursor in the Page Content field.

b)    From the Ribbon Insert tab, choose Picture, and then choose From    SharePoint.

c)     Select the image that you want to add to the page and then choose Insert. The image will be displayed at full size.

d)    Next on the Design tab, in the Select group, choose Pick Rendition, and then select an  image rendition whichever required. That’s it, the image will display according to the size  specified for the image rendition.

Hope this helps... 

Tuesday, March 14, 2017

What is a BLOB cache in SharePoint and how to use it?

Hi Friends,

In this article, we are going to learn what is a BLOB cache and how to configure it.

The term BLOB means Binary Large Objects. BLOB cache is one of the disk-based caching techniques used in the SharePoint applications which has large amounts of Media content (Video, Audio and Images etc.,) and heavy user traffic.

So basically this method is used to improve the performance of a SharePoint Application. You can also find some of the other SharePoint performance improvement techniques here.

Disk-based caching techniques are extremely fast which eliminates the need for database round trips. BLOBs are retrieved from the database once and stored on the Web client(WFE server). Further requests are served from the cache and trimmed based on security.

Note: If you are using Image Renditions in the application, then BLOB Cache is the pre-requisite.

We can enable/disable the BLOB cache by modifying the web.config file of the SharePoint web application.
By Default, BLOB cache is disabled. Below is how it looks like.

<BlobCache location="C:\blobCache" path="\.(gif|jpg|png|css|js)$" maxSize="10" enabled="false" />

- Location is the directory where the cached files will be stored.
- Path specifies which files(Ex: mov|mp3|mp4|mpeg|mpg) are cached based on the file extension.
- maxSize is the maximum allowable size of the disk-based cache in gigabytes.

- enabled is a Boolean that disables or enables the cache.

To turn ON the BLOB, just make the property enabled as true as shown below.

<BlobCache location="C:\blobCache" path="\.(gif|jpg|png|css|js)$" maxSize="10" enabled="true" />

Note : change the location attribute to specify a directory that has enough space to accommodate the cache size.


Hope this helps...

Monday, March 13, 2017

What is the difference between Local Storage and Cookies

Hi Friends,

In this post we are going to talk about when to use Local storage and Cookies.

To begin with, this is an extremely broad scope question, and a lot of pros/cons will be contextual to the situation.

Please find the below differences.


Local Storage
Cookies
Good to store large amount of data, up to 4MB
Good for small amount of data.
Cookies give you a limit of 4096 bytes (4095, actually) per cookie
Local Storage allow you to store JavaScript primitives but not Objects or Arrays (it is possible to JSON serialize them to store them using the APIs)
Cookies only allow you to store strings
Local storage data is not sent to the server on every request (HTTP header) as it is purely at the client side
All data is transferred to and from server, so bandwidth is consumed on every request
It stores data with no expiration date, and gets cleared only through JavaScript, or clearing the Browser Cache / Locally Stored Data
Can specify timeout period so that cookies data are removed from browser
Local storage stores the data in the form of key and value

Not supported by anything before: IE 8, Firefox 3.5, Safari 4, Chrome 4, Opera 10.5, iOS 2.0, Android 2.0
local storage can only be read client-side



Hope this helps...

Popular Posts