The ImageSize validator checks the size of image files.
It supports the following options:
minheight: Sets the minimum image height.
maxheight: Sets the maximum image height.
minwidth: Sets the minimum image width.
maxwidth: Sets the maximum image width.
The methods setImageMin() and
setImageMax() also set both minimum and maximum values, while
the methods getMin() and getMax()
return the currently set values.
For your convenience there are also the setImageWidth() and
setImageHeight() methods, which set the minimum and maximum
height and width of the image file. They, too, have corresponding
getImageWidth() and getImageHeight()
methods to retrieve the currently set values.
To bypass validation of a particular dimension, the relevent option simply should not be set.
Example 405. Using the ImageSize Validator
<?php
$upload = new Zend_File_Transfer();
// Limit the size of a image to a height of 100-200 and a width of
// 40-80 pixel
$upload->addValidator('ImageSize', false,
array('minwidth' => 40,
'maxwidth' => 80,
'minheight' => 100,
'maxheight' => 200)
);
// Reset the width for validation
$upload->setImageWidth(array('minwidth' => 20, 'maxwidth' => 200));




