How to resize images in Magento 1 & 2?
Magento search not working
How to create URL redirect in Magento 1 & 2
Please re-run Magento compile command
Magento PWA examples
Printable View
How to resize images in Magento 1 & 2?
Magento search not working
How to create URL redirect in Magento 1 & 2
Please re-run Magento compile command
Magento PWA examples
Resize images in Magento 1
<code>
<img src="<?php echo $this->helper('catalog/image')->init($this->getProduct(), 'thumbnail',<br/> $_image->getFile())->backgroundcolor('000', '000', '000')->resize(100); ?>" ... />
</code>
Resize images in Magento 2
<?php
/**
*
* @var \Magento\Catalog\Model\ProductRepository
*/
protected $_productRepository;
/**
*
* @var \Magento\Catalog\Helper\Image
*/
protected $_productImageHelper;
/**
* @param \Magento\Backend\Block\Template\Context $context
* @param \Magento\Catalog\Model\ProductRepository $productRepository
* @param \Magento\Catalog\Helper\Image $productImageHelper
* @param array $data
*/
public function __construct(
\Magento\Backend\Block\Template\Context $context,
\Magento\Catalog\Model\ProductRepository $productRepository,
\Magento\Catalog\Helper\Image $productImageHelper,
array $data = []
)
{
$this->_productRepository = $productRepository;
$this->_productImageHelper = $productImageHelper;
parent::__construct($context, $data);
}
/**
* resize of the image
* @see \Magento\Catalog\Model\Product\Image
* @param int $width
* @param int $height
* @return $this
*/
public function resizeImage($id, $image_type, $width, $height = null)
{
$product = $this->_productRepository->getById($id);
$resizedImage = $this->_productImageHelper->init($product, $image_type)
->constrainOnly(TRUE)
->keepAspectRatio(TRUE)
->keepTransparency(TRUE)
->keepFrame(FALSE)
->resize($width, $height);
return $resizedImage;
}
Check out this link: https://www.simicart.com/blog/magento-resize-images/
If you dont know how to do it yourself, why dont you handover the job to your graphic designer?
Magento does not have any default resize function for category like product.
So, you need to use Varien_Image class for this purpose.
Team Building Activities in Delhi | Corporate Team Building Games | Corporate Team Building Activities
I was not knowing this, thanks for sharing
I followed their steps (y) anf it works
Thanks for sharing me information <3