Magento 2 change max image height and width of image uploader in Admin?

We should not override the constant variables of class.

If having already a custom admin theme, you can override these templates in your custom admin theme.

I saw some templates which use these constant variables:

vendor/magento/module-backend/view/adminhtml/templates/media/uploader.phtml

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

enter image description here

Read more here: http://devdocs.magento.com/guides/v2.1/frontend-dev-guide/themes/admin_theme_create.html


I needed this only for product images and I didn't want to create a custom admin theme. So I used the event catalog_product_gallery_prepare_layout.

adminhtml/events.xml

<?xml version="1.0"?>
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:Event/etc/events.xsd">
<event name="catalog_product_gallery_prepare_layout">
    <observer name="vendor_module_catalog_product_gallery_prepare_layout" instance="Vendor\Module\Observer\CatalogProductGalleryPrepareLayout" />
</event>

Observer/CatalogProductGalleryPrepareLayout.php

<?php

namespace Vendor\Module\Observer;

use Magento\Framework\Event\Observer;
use Magento\Framework\Event\ObserverInterface;

class CatalogProductGalleryPrepareLayout implements ObserverInterface
{

    public function execute(Observer $observer)
    {
         $block = $observer->getBlock();
         if (!$block) return;

         $uploaderBlock = $block->getChildBlock('uploader');
         if (!$uploaderBlock) return;

         $uploaderBlock->setTemplate('Vendor_Module::media/uploader.phtml');
     }
 }

and of course you should override the template:

view/adminhtml/templates/media/uploader.phtml