Magento – how to change or off in backend for uploading image default MAX WIDTH

image-uploadmagento2

In Backend -> PRODUCTS -> CATALOG -> [any product] -> Images and Videos when uploading images, Magento automatically makes resize(max-width 1920px). I need a image width 2600px. each product with self background. I created the Image-attribute: produkt_bg and show it on the product page. but the width is not enough.

How do I change this or turn it off in backend for uploading image default MAX WIDTH?

Best Answer

After a lot of digging in the code, I found that M2 resize the image on the client, that's it, before even uploading to the server. This will be true if you use a browser that support Canvas and the File API.

To prevent this, you have to remove:

// vendor/magento/module-backend/view/adminhtml/web/js/media-uploader.js:113
{
     action: 'resize',
     maxWidth: this.options.maxWidth,
     maxHeight: this.options.maxHeight
},

To be honest, I don't know exactly how to remove it in a clean way. The "easy way" would be remapping Magento_Backend/js/media-uploader to a custom js file and brutally copy/paste.

By the way, the above file is called here:
vendor/magento/module-backend/view/adminhtml/templates/media/uploader.phtml