0

Created a custom image in category_form.xml i need to validate the image height and width while upload if its exceeds the allowed dimensions should display the alert message

<field name="thumbnail_logo" sortOrder="104" 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">Category Image</label>
            <visible>true</visible>
            <required>false</required>
        </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>

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Browse other questions tagged or ask your own question.