1

I want To validate Image Height And Width on Submit in Magento Admin Back-end. I want to upload & different Sizes Of Images by magento admin...So For That I want to validate image Height and Width In magento admin form upload field...

$fieldset->addField('image_1', 'file', array(
            'label' => Mage::helper('frontlayout')->__('Layout Image'),
            'required' => true,
            'name' => 'image_1',
            'class' => 'required-entry',
        ));

1 Answer 1

0

If you are looking to validate the image uploaded for the catalog<

public function validateUploadFile($filePath) {

    $testsize[] = getimagesize($filePath);
    if (!(getimagesize($filePath)) || ($testsize[0][0] < 900) || ($testsize[0][1] < 900)) {
        Mage::throwException($this->__('Image size must be same or greater than 900px * 900px .'));
    }

    $_processor = new Varien_Image($filePath);
    return $_processor->getMimeType() !== null;
}
1
  • solution needed in prototype not in php Commented Dec 22, 2015 at 13:05

Your Answer

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.