1

I'm using Magento 2.3.4, and now I'm extending the category form to add new field input image like this:

app/code/Vendor/Module/view/adminhtml/ui_component/category_form.xml

  <field name="banner_io" sortOrder="40" formElement="imageUploader">
        <argument name="data" xsi:type="array">
            <item name="config" xsi:type="array">
                <item name="source" xsi:type="string">category</item>
            </item>
        </argument>
        <settings>
            <elementTmpl>ui/form/element/uploader/image</elementTmpl>
            <dataType>string</dataType>
            <label translate="true">Banner IO</label>
            <comment translate="true">Dimension: 900px X 354px</comment>
            <visible>true</visible>
            <required>false</required>
            <scopeLabel>[STORE VIEW]</scopeLabel>
        </settings>
        <formElements>
            <imageUploader>
                <settings>
                    <required>false</required>
                    <uploaderConfig>
                        <param xsi:type="url" name="url" path="catalog/category_image/upload"/>
                    </uploaderConfig>
                    <previewTmpl>Magento_Catalog/image-preview</previewTmpl>
                    <openDialogTitle>Media Gallery</openDialogTitle>
                    <initialMediaGalleryOpenSubpath>catalog/category</initialMediaGalleryOpenSubpath>
                    <allowedExtensions>jpg jpeg gif png</allowedExtensions>
                    <maxFileSize>4194304</maxFileSize>
                </settings>
            </imageUploader>
        </formElements>
    </field>

in here I can set the max file size, how I can set minimum/maximum width and height?

1

You can set Width & Height in dashboard.

Stores > Configuration > Advanced > System > Images Upload Configuration

enter image description here

| improve this answer | |
  • Is this gonna effect all the image uploader ? i just need it for this specific input not all – jojo Mar 3 at 6:24

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.