3

When uploading new images to a product in Magento 2, it is not only decreasing the dimensions of the image, but it's increasing the image file size:

Image Details Before Upload

  • Dimensions: 1185 ×ばつ 1580 px
  • File Size: 446 KB

After Upload

enter image description here

Can anybody explain why this is happening? I accept that some data may be added to the image by Magento, but I don't understand why it has been resized? Is there anywhere this can be changed?

EDIT

I've now discovered that the image dimensions have been set in vendor/magento/framework/File/Uploader.php

enter image description here

Next is to find the best way to change these values, I found this related post: Magento 2 change max image height and width of image uploader in Admin?

I still don't know why these dimensions have been imposed on users on M2. nor why the file size more than doubles in size!

asked Mar 15, 2017 at 15:21
1

2 Answers 2

1

Now the max image size can be set at Stores > Settings > Configuration > Advanced > System > Images Upload Configuration

see https://docs.magento.com/user-guide/catalog/product-image-resizing.html

answered Jul 21, 2020 at 14:38
1
  • Thank you, saved me a lot of time troubleshooting! Commented Oct 21, 2024 at 6:45
0

In the end I created a new theme to override the following two files where the restriction was added:

  • vendor/magento/module-cms/view/adminhtml/templates/browser/content/uploader.phtml
  • vendor/magento/module-backend/view/adminhtml/templates/media/uploader.phtml

Within those files I hard coded the new max image sizes:

"maxWidth":3000,
"maxHeight":3000

This is the post I followed to achieve the override: https://magento.stackexchange.com/a/153968/191

Regarding the image file size I have not found a definitive answer as to why the size has more than doubled. This post had some insight however: https://stackoverflow.com/questions/14008524/why-smaller-png-image-takes-up-more-space-than-the-original-after-getting-resize

answered Mar 16, 2017 at 15:16

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

By clicking "Post Your Answer", you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.