Resize product images in Magento2
To resize product images in Magento2, you just have to add a etc/view.xml into your own theme (f.e. app/design/frontend/Sheldon/Happytheme/etc/view.xml) ans add something like that:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 |
<?xml version="1.0"?> <!-- /** * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ --> <view xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:Config/etc/view.xsd"> <media> <images module="Magento_Catalog"> <image id="product_image" type="image"> <width>800</width> <height>800</height> </image> <image id="product_small_image" type="small_image"> <width>500</width> <height>500</height> </image> <image id="product_thumbnail_image" type="thumbnail"> <width>300</width> <height>300</height> </image> <image id="swatch_image" type="swatch_image"> <width>75</width> <height>75</height> </image> </images> </media> </view> |
As you can see, you can adapt the image dimensions for each image type available. That works also for self installed image types. The values for width and height are […]