PHP Класс yii\validators\ImageValidator

С версии: 2.0
Автор: Taras Gudz ([email protected])
Наследование: extends FileValidator
Показать файл Открыть проект Примеры использования класса

Открытые свойства

Свойство Тип Описание
$maxHeight the maximum width in pixels. Defaults to null, meaning no limit.
$maxWidth the maximum width in pixels. Defaults to null, meaning no limit.
$minHeight the minimum height in pixels. Defaults to null, meaning no limit.
$minWidth the minimum width in pixels. Defaults to null, meaning no limit.
$notImage the error message used when the uploaded file is not an image. You may use the following tokens in the message: - {attribute}: the attribute name - {file}: the uploaded file name
$overHeight the error message used when the image is over [[maxHeight]]. You may use the following tokens in the message: - {attribute}: the attribute name - {file}: the uploaded file name - {limit}: the value of [[maxHeight]]
$overWidth the error message used when the image is over [[maxWidth]]. You may use the following tokens in the message: - {attribute}: the attribute name - {file}: the uploaded file name - {limit}: the value of [[maxWidth]]
$underHeight the error message used when the image is under [[minHeight]]. You may use the following tokens in the message: - {attribute}: the attribute name - {file}: the uploaded file name - {limit}: the value of [[minHeight]]
$underWidth the error message used when the image is under [[minWidth]]. You may use the following tokens in the message: - {attribute}: the attribute name - {file}: the uploaded file name - {limit}: the value of [[minWidth]]

Открытые методы

Метод Описание
clientValidateAttribute ( $model, $attribute, $view )
init ( )

Защищенные методы

Метод Описание
getClientOptions ( $model, $attribute )
validateImage ( UploadedFile $image ) : array | null Validates an image file.
validateValue ( $value )

Описание методов

clientValidateAttribute() публичный Метод

public clientValidateAttribute ( $model, $attribute, $view )

getClientOptions() защищенный Метод

protected getClientOptions ( $model, $attribute )

init() публичный Метод

public init ( )

validateImage() защищенный Метод

Validates an image file.
protected validateImage ( UploadedFile $image ) : array | null
$image yii\web\UploadedFile uploaded file passed to check against a set of rules
Результат array | null the error message and the parameters to be inserted into the error message. Null should be returned if the data is valid.

validateValue() защищенный Метод

protected validateValue ( $value )

Описание свойств

$maxHeight публичное свойство

the maximum width in pixels. Defaults to null, meaning no limit.
См. также: overWidth for the customized message used when image height is too big.
public $maxHeight

$maxWidth публичное свойство

the maximum width in pixels. Defaults to null, meaning no limit.
См. также: overWidth for the customized message used when image width is too big.
public $maxWidth

$minHeight публичное свойство

the minimum height in pixels. Defaults to null, meaning no limit.
См. также: underHeight for the customized message used when image height is too small.
public $minHeight

$minWidth публичное свойство

the minimum width in pixels. Defaults to null, meaning no limit.
См. также: underWidth for the customized message used when image width is too small.
public $minWidth

$notImage публичное свойство

the error message used when the uploaded file is not an image. You may use the following tokens in the message: - {attribute}: the attribute name - {file}: the uploaded file name
public $notImage

$overHeight публичное свойство

the error message used when the image is over [[maxHeight]]. You may use the following tokens in the message: - {attribute}: the attribute name - {file}: the uploaded file name - {limit}: the value of [[maxHeight]]
public $overHeight

$overWidth публичное свойство

the error message used when the image is over [[maxWidth]]. You may use the following tokens in the message: - {attribute}: the attribute name - {file}: the uploaded file name - {limit}: the value of [[maxWidth]]
public $overWidth

$underHeight публичное свойство

the error message used when the image is under [[minHeight]]. You may use the following tokens in the message: - {attribute}: the attribute name - {file}: the uploaded file name - {limit}: the value of [[minHeight]]
public $underHeight

$underWidth публичное свойство

the error message used when the image is under [[minWidth]]. You may use the following tokens in the message: - {attribute}: the attribute name - {file}: the uploaded file name - {limit}: the value of [[minWidth]]
public $underWidth