Pages

06 October, 2013

Sitecore: Image Resizer Pipeline (ResizeProcessor) Pipeline

Sitecore has a feature in processing high resolution images while rendering in the website.

Let’s say, content authors wants to use an image as Icon, Thumbnail and full scale in the website. Normally, they will upload three images in icon sized, thumbnail sized and full scale images. They will have different name to differentiate the sizes. They can use (<img src="/url/image.png" height="100" width="100") image tag with height and width but it will render with high resolution image size even for thumbnail. But Sitecore has an option of resizing the image at runtime. 

There is a pipeline in the <getMediaStream>.

<processor type="Sitecore.Resources.Media.ResizeProcessor, Sitecore.Kernel" />

This pipeline has the following advantages.
  • Depending upon the width and the height in the media url, this will resize the image and render it.  /~/media/image.JPG?h=300&w=400
  • While resizing the image, it will reduce the size of the image as well.
  • Authors can use same name for Icon, Thumbnail and Full Scale. 

Example:

High Resolution Image Size: 4.70 MB (4,938,293 bytes)

Without processor (Size – 4.7 MB): http://sitecore1/~/media/flower.JPG?h=300&w=400


With processor (Size – 55 KB): http://sitecore1/~/media/flower.JPG?h=300&w=400


Of course, there will be a performance impact for resizing at runtime. To avoid the impact, the site can be configured for ARRCache which will reduce the load on the subsequent request.


No comments:

Post a Comment

blockquote { margin: 0; } blockquote p { padding: 15px; background: #eee; border-radius: 5px; } blockquote p::before { content: '\201C'; } blockquote p::after { content: '\201D'; }