K
K
Ken Jee2016-09-22 17:11:13
Yii
Ken Jee, 2016-09-22 17:11:13

Where can I see an example of using the ImageValidator class in Yii2?

I am making a mechanism for uploading photos to the server. Where can I see a practical example of using the ImageValidator class in Yii2? Preferably in conjunction with \yii\web\UploadedFile.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
M
Maxim Timofeev, 2016-09-22
@Machez

https://github.com/yiisoft/yii2/blob/master/docs/g...

[
    // проверяет, что "primaryImage" - это валидное изображение с указанными размерами
    ['primaryImage', 'image', 'extensions' => 'png, jpg',
        'minWidth' => 100, 'maxWidth' => 1000,
        'minHeight' => 100, 'maxHeight' => 1000,
    ],
]

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question