class ImageTypeValidator extends AbstractValidator (View source)

Validator that checks the type of a given image

Example: [at]Flow\Validate("$image", type="\Neos\Media\Validator\ImageTypeValidator", options={ "allowedTypes"={"jpeg", "png"} })

Properties

protected array $supportedOptions

Methods

void
isValid(ImageInterface $image)

The given $value is valid if it is an \Neos\Media\Domain\Model\ImageInterface of the configured type (one of the image/* IANA media subtypes)

void
validateOptions()

Checks if this validator is correctly configured

Details

protected void isValid(ImageInterface $image)

The given $value is valid if it is an \Neos\Media\Domain\Model\ImageInterface of the configured type (one of the image/* IANA media subtypes)

Note: a value of NULL or empty string ('') is considered valid

Parameters

ImageInterface $image

The image that should be validated

Return Value

void

protected void validateOptions()

Checks if this validator is correctly configured

Return Value

void

Exceptions

InvalidValidationOptionsException

if the configured validation options are incorrect