Magento is very powerful e-commerce platform these days. When we think about any CMS or shopping cart, First thing comes in mind is theming any CMS or shopping. Magento theming is not really as hard as you think. Its little bit different from wordpress and joomla.
In Magento theming, we always have to create product image thumbnails. For Product thumbnails image resizing work perfectly in Magento, But sometimes you need to crop image instead of just resizing. So that image will not distort. In this scenario Magento resizing tools doesn’t work.
In that case we can adaptive resizing.
What is Adaptive Resizing?
Adaptive resizing is ideal in a situation when your thumbnail images are always uniform in width and height, as it not matter the original image orientation. Adaptive resizing is resizing your image down to the closest match and then crops from center to the desired width and height.
How to use Adaptive Resize in Magento?
Leon Smith have uploaded a plugin “Magento Adaptive Resize”. Download that plugin from this url and upload to Magento directory.
Now you can use adaptive resize plugin as below
1 | <img src="<?php echo $this->helper('adaptiveResize/image')->init($_product, 'thumbnail')->adaptiveResize(160, 213) ?>" width="160" height="213" alt="<?php echo $this->htmlEscape($_product->getName()); ?>" /> |
Instead of
1 | <img src="<?php echo $this->helper('catalog/image')->init($_product, 'thumbnail')->adaptiveResize(160, 213) ?>" width="160" height="213" alt="<?php echo $this->htmlEscape($_product->getName()); ?>" /> |
Thanks for reading this post!