public function validateImageSize($attribute, $value, $parameters)
{
$image = $this->getImagePath($value);
// Get the image dimension info, or fail.
$image_size = @getimagesize($image);
if ($image_size === false) {
return false;
}
// If only one dimension rule is passed, assume it applies to both height and width.
if (!isset($parameters[1])) {
$parameters[1] = $parameters[0];
}
// Parse the parameters. Options are:
//
// "300" or "=300" - dimension must be exactly 300 pixels
// "<300" - dimension must be less than 300 pixels
// "<=300" - dimension must be less than or equal to 300 pixels
// ">300" - dimension must be greater than 300 pixels
// ">=300" - dimension must be greater than or equal to 300 pixels
$width_check = $this->checkDimension($parameters[0], $image_size[0]);
$height_check = $this->checkDimension($parameters[1], $image_size[1]);
return $width_check['pass'] && $height_check['pass'];
}