This validation line doesn't work. i could upload images in any dimension.
['image', 'image', 'minWidth' => 250, 'maxWidth' => 250,'minHeight' => 250, 'maxHeight' => 250],
in the controller, i use.
$image = UploadedFile::getInstance($this, 'image');
There's nothing wrong with the last line as far as I can see. https://github.com/yiisoft/yii2/blob/master/docs/guide/tutorial-core-validators.md#yiivalidatorsimagevalidatorimage-
But you're declaring rules for the
image
attribute twice - one as a file, and one as a image. The image validator extends from the file validator, so it inherits all its properties.Try combining it in to one rule, and see if that helps.
Edit: And you need to save the image in the
$model
, like$model->image
for it to be validated through the model validation rules if you're in the controller.Here is a good example: http://www.yiiframework.com/doc-2.0/guide-input-file-upload.html