Kentico CMS 7.0 E-commerce Guide

Resizing images

Resizing images

Previous topic Next topic Mail us feedback on this topic!  

Resizing images

Previous topic Next topic JavaScript is required for the print function Mail us feedback on this topic!  

This chapter describes how you can resize product images. Please note that you can resize any image the following way using the respective methods (i.e. GetImage() and GetImageByUrl() ) with appropriate parameters.

 

You can set a size of the original image (width: 422px, height: 266px) using the GetSKUImageUrl method in the following ways:

 

Setting the Maxsidesize value

Setting the Height value

Setting the Width value

Setting the Width and Height values

 

ecommerceguide_clip0618

 

Setting the Maxsidesize value

 

This sets the longer side to the value specified as Maxsidesize. The other side is calculated automatically, and so the aspect ratio remains the same as it is in the original image. In the following image, Maxsidesize is set to 240px.

 

GetSKUImageUrl(240)

 

ecommerceguide_clip0619

 

Setting the Height value

 

This sets the height of an image. The width is calculated automatically, and so the aspect ratio remains the same as it is in the original image. In the following image, Height is set to 170px.

 

GetSKUImageUrl(0,170)

 

ecommerceguide_clip0620

 

Setting the Width value

 

This sets the width of an image. The height is calculated automatically, and so the aspect ratio remains the same as it is in the original image. In the following image, Width is set to 200px.

 

GetSKUImageUrl(200,0)

 

ecommerceguide_clip0621

 

Setting the Width and Height values

 

The given values are set on condition that they are not greater than the original size of an image. Please note that the aspect ratio may not be maintained. In the following image, Width is set to 150px and Height is set to 240px.

 

GetSKUImageUrl(150,240)

 

ecommerceguide_clip0622

 

In the following image, Width is set to 240px and Height is set to 150px.

 

GetSKUImageUrl(240,150)

 

ecommerceguide_clip0623

 

If at least one value is greater than the original size, the original image size is set. In the following image, Width is set to 600px and Height is set to 500px.

 

GetSKUImageUrl(600,500)

 

ecommerceguide_clip0618