I met one strange issue in Magento 2 – I’m trying to change default uploading image size from 800x1200
to 934x1400
.
I modified view.xml
and now uploaded images going straight to folder media/catalog/product/cache/1/image/934x1400/
<image id="product_page_main_image" type="image">
<width>934</width>
<height>1400</height>
</image>
<image id="product_page_main_image_default" type="image">
<width>934</width>
<height>1400</height>
</image>
<image id="product_page_image_large" type="image">
<width>934</width><!-- 800 -->
<height>1400</height><!-- 1090 -->
</image>
<image id="product_page_image_medium" type="image">
<width>934</width><!-- 800 -->
<height>1400</height><!-- 1090 -->
</image>
But their actual size is still 800x1200
Any ideas how to solve this issue? I can’t find any settings to modify default uploading image size.
Best Answer
There are two ways to change max resizing width & height of the image after uploading:
1)
Magento\Framework\File\Uploader.php
contain constantsMAX_IMAGE_HEIGHT
&MAX_IMAGE_WIDTH
which is set to 1200 by default2)
magento/module-backend/view/adminhtml/templates/media/uploader.phtml
contains PHP code for echo same constantsMAX_IMAGE_HEIGHT
andMAX_IMAGE_WIDTH
. You can just hardcode your value instead these values.