On way to achieve it :
Update the app/design/frontend/{VendorName}/{ThemeName}/etc/view.xml of your theme :
<image id="product_custom_image" type="image_productlist">
<width>265</width>
<height>265</height>
</image>
You need to update the default configuration file view.xsd as described in this post with a plugin: Extending the complexType named "imageType" with a custom image type Extending the complexType named "imageType" with a custom image type
<xs:enumeration value="image_productlist"/>
Then use the default image helper function in order to retrieve your image type such as :
/**
* @var \Magento\Catalog\Helper\ImageFactory
*/
protected $helperFactory;
$image = $this->helperFactory->create()->init($product, 'product_custom_image')
->constrainOnly(true)
->keepAspectRatio(true)
->keepTransparency(true)
->keepFrame(false)
->resize(200, 300);
$imageUrl = $image->getUrl();
On way to achieve it :
Update the app/design/frontend/{VendorName}/{ThemeName}/etc/view.xml of your theme :
<image id="product_custom_image" type="image_productlist">
<width>265</width>
<height>265</height>
</image>
You need to update the default configuration file view.xsd as described in this post with a plugin: Extending the complexType named "imageType" with a custom image type
<xs:enumeration value="image_productlist"/>
Then use the default image helper function in order to retrieve your image type such as :
/**
* @var \Magento\Catalog\Helper\ImageFactory
*/
protected $helperFactory;
$image = $this->helperFactory->create()->init($product, 'product_custom_image')
->constrainOnly(true)
->keepAspectRatio(true)
->keepTransparency(true)
->keepFrame(false)
->resize(200, 300);
$imageUrl = $image->getUrl();
On way to achieve it :
Update the app/design/frontend/{VendorName}/{ThemeName}/etc/view.xml of your theme :
<image id="product_custom_image" type="image_productlist">
<width>265</width>
<height>265</height>
</image>
You need to update the default configuration file view.xsd as described in this post with a plugin: Extending the complexType named "imageType" with a custom image type
<xs:enumeration value="image_productlist"/>
Then use the default image helper function in order to retrieve your image type such as :
/**
* @var \Magento\Catalog\Helper\ImageFactory
*/
protected $helperFactory;
$image = $this->helperFactory->create()->init($product, 'product_custom_image')
->constrainOnly(true)
->keepAspectRatio(true)
->keepTransparency(true)
->keepFrame(false)
->resize(200, 300);
$imageUrl = $image->getUrl();
On way to achieve it :
Update the app/design/frontend/{VendorName}/{ThemeName}/etc/view.xml of your theme :
<image id="product_custom_image" type="image_productlist">
<width>265</width>
<height>265</height>
</image>
You need to update the default configuration file view.xsd as described in this post with a plugin: Extending the complexType named "imageType" with a custom image type
<xs:enumeration value="image_productlist"/>
Then use the default image helper function in order to retrieve your image type such as :
/**
* @var \Magento\Catalog\Helper\ImageFactory
*/
protected $helperFactory;
$image = $this->helperFactory->create()->init($product, 'product_custom_image')
->constrainOnly(true)
->keepAspectRatio(true)
->keepTransparency(true)
->keepFrame(false)
->resize(200, 300);
$imageUrl = $image->getUrl();