W3cubDocs

/Symfony 4.1

Image

class Image extends File

Constants

DEFAULT_GROUP

The name of the group given to all constraints with no explicit group.

CLASS_CONSTRAINT

Marks a constraint that can be put onto classes.

PROPERTY_CONSTRAINT

Marks a constraint that can be put onto properties.

NOT_FOUND_ERROR
NOT_READABLE_ERROR
EMPTY_ERROR
TOO_LARGE_ERROR
INVALID_MIME_TYPE_ERROR
SIZE_NOT_DETECTED_ERROR
TOO_WIDE_ERROR
TOO_NARROW_ERROR
TOO_HIGH_ERROR
TOO_LOW_ERROR
TOO_FEW_PIXEL_ERROR
TOO_MANY_PIXEL_ERROR
RATIO_TOO_BIG_ERROR
RATIO_TOO_SMALL_ERROR
SQUARE_NOT_ALLOWED_ERROR
LANDSCAPE_NOT_ALLOWED_ERROR
PORTRAIT_NOT_ALLOWED_ERROR
CORRUPTED_IMAGE_ERROR

Properties

static protected $errorNames
mixed $payload Domain-specific data attached to a constraint. from Constraint
array $groups The groups that the constraint belongs to from Constraint
$binaryFormat from File
$mimeTypes
$notFoundMessage from File
$notReadableMessage from File
$maxSizeMessage from File
$mimeTypesMessage
$disallowEmptyMessage from File
$uploadIniSizeErrorMessage from File
$uploadFormSizeErrorMessage from File
$uploadPartialErrorMessage from File
$uploadNoFileErrorMessage from File
$uploadNoTmpDirErrorMessage from File
$uploadCantWriteErrorMessage from File
$uploadExtensionErrorMessage from File
$uploadErrorMessage from File
int $maxSize from File
$minWidth
$maxWidth
$maxHeight
$minHeight
$maxRatio
$minRatio
$minPixels
$maxPixels
$allowSquare
$allowLandscape
$allowPortrait
$detectCorrupted
$sizeNotDetectedMessage
$maxWidthMessage
$minWidthMessage
$maxHeightMessage
$minHeightMessage
$minPixelsMessage
$maxPixelsMessage
$maxRatioMessage
$minRatioMessage
$allowSquareMessage
$allowLandscapeMessage
$allowPortraitMessage
$corruptedMessage

Methods

static string getErrorName(string $errorCode)

Returns the name of the given error code.

from Constraint
__construct(mixed $options = null)

Initializes the constraint with options.

from File
__set(string $option, mixed $value)

Sets the value of a lazily initialized option.

from File
mixed __get(string $option)

Returns the value of a lazily initialized option.

from File
bool __isset(string $option) from File
addImplicitGroupName(string $group)

Adds the given group if this constraint is in the Default group.

from Constraint
string getDefaultOption()

Returns the name of the default option.

from Constraint
array getRequiredOptions()

Returns the name of the required options.

from Constraint
string validatedBy()

Returns the name of the class that validates this constraint.

from Constraint
string|array getTargets()

Returns whether the constraint can be put onto classes, properties or both.

from Constraint
array __sleep()

Optimizes the serialized value to minimize storage space.

from Constraint

Details

static string getErrorName(string $errorCode)

Returns the name of the given error code.

Parameters

string $errorCode The error code

Return Value

string The name of the error code

Exceptions

InvalidArgumentException If the error code does not exist

__construct(mixed $options = null)

Initializes the constraint with options.

You should pass an associative array. The keys should be the names of existing properties in this class. The values should be the value for these properties.

Alternatively you can override the method getDefaultOption() to return the name of an existing property. If no associative array is passed, this property is set instead.

You can force that certain options are set by overriding getRequiredOptions() to return the names of these options. If any option is not set here, an exception is thrown.

Parameters

mixed $options The options (as associative array) or the value for the default option (any other type)

Exceptions

InvalidOptionsException When you pass the names of non-existing options
MissingOptionsException When you don't pass any of the options returned by getRequiredOptions()
ConstraintDefinitionException When you don't pass an associative array, but getDefaultOption() returns null

__set(string $option, mixed $value)

Sets the value of a lazily initialized option.

Corresponding properties are added to the object on first access. Hence this method will be called at most once per constraint instance and option name.

Parameters

string $option The option name
mixed $value The value to set

Exceptions

InvalidOptionsException If an invalid option name is given

mixed __get(string $option)

Returns the value of a lazily initialized option.

Corresponding properties are added to the object on first access. Hence this method will be called at most once per constraint instance and option name.

Parameters

string $option The option name

Return Value

mixed The value of the option

Exceptions

InvalidOptionsException If an invalid option name is given

bool __isset(string $option)

Parameters

string $option The option name

Return Value

bool

addImplicitGroupName(string $group)

Adds the given group if this constraint is in the Default group.

Parameters

string $group

string getDefaultOption()

Returns the name of the default option.

Override this method to define a default option.

Return Value

string

See also

__construct()

array getRequiredOptions()

Returns the name of the required options.

Override this method if you want to define required options.

Return Value

array

See also

__construct()

string validatedBy()

Returns the name of the class that validates this constraint.

By default, this is the fully qualified name of the constraint class suffixed with "Validator". You can override this method to change that behaviour.

Return Value

string

string|array getTargets()

Returns whether the constraint can be put onto classes, properties or both.

This method should return one or more of the constants Constraint::CLASS_CONSTRAINT and Constraint::PROPERTY_CONSTRAINT.

Return Value

string|array One or more constant values

array __sleep()

Optimizes the serialized value to minimize storage space.

Return Value

array The properties to serialize

© 2004–2017 Fabien Potencier
Licensed under the MIT License.
https://api.symfony.com/4.1/Symfony/Component/Validator/Constraints/Image.html