Hi i want to Create custom Featured Product in Magento 2. Below code use to get Product images:
$productImage = $block->getImage($_product, $image);
if ($pos != null) {
$position = ' style="left:' . $productImage->getWidth() . 'px;'
. 'top:' . $productImage->getHeight() . 'px;"';
}
echo $productImage->toHtml();
Currently Getting Image size as per Define in etc/view.xml
in Theme, But i want to change Custom Image size for feature product in Homepage.
Best Answer
In your PHTML file you need to set $image = 'homepage_page_grid'; tag as I show here.
then use this $image tag in product Image like below.
now go to vendor_name/theme/name/etc/view.xml file and add your image with id that you set in PHTML file.
Hope this will help you.