ImageFileValidator
ImageFileValidator verifies a parameter is an uploaded image Parameters: ‘min_width’ The minimum width of the image ‘max_width’ The maximum width of the image ‘min_height’ The minimum height of the image ‘max_height’ The maximum height of the image ‘format’ list of valid formats (gif,jpeg,png,bmp,psd,swf) Errors: ‘no_image’ The uploaded file is no image ‘min_width’ ‘max_width’ ‘min_height’ ‘max_height’ ‘format’ The image was not in the required format
Synopsis
Section titled “Synopsis”class ImageFileValidator extends BaseFileValidator
| Extends | BaseFileValidator |
| Since | 1.0.0 |
| Source | Validator/ImageFileValidator.php |
Methods
Section titled “Methods”| Method | Description |
|---|---|
getAcceptedParameters(): array<int, string> | Returns the file-validator parameters plus ‘min_width’, ‘max_width’, ‘min_height’, ‘max_height’ and ‘format’. |
getAcceptedParameters()
Section titled “getAcceptedParameters()”public static function getAcceptedParameters(): array<int, string>
Returns the file-validator parameters plus ‘min_width’, ‘max_width’, ‘min_height’, ‘max_height’ and ‘format’.
The four dimension parameters bound the pixel size read out of the uploaded image itself, each checked only when present. ‘format’ is a list of acceptable image formats, given either as an array or as a space-delimited string and matched case-insensitively against the extension for the detected image type, with ‘jpg’ and ‘tif’ accepted alongside the ‘jpeg’ and ‘tiff’ PHP reports. The size, extension and MIME parameters inherited from BaseFileValidator apply as well.
Returns array``<``int``, ``string``> — The accepted parameter names.
Inherited methods
Section titled “Inherited methods”These come from an ancestor and are documented where they are declared.
| Method | Declared in | Description |
|---|---|---|
appendParameter() | ParameterHolder | Append a parameter. |
appendParameterByRef() | ParameterHolder | Append a parameter by reference. |
clearParameters() | ParameterHolder | Clear all parameters associated with this request. |
execute() | Validator | Executes the validator. |
getArguments() | Validator | Returns all arguments which should be validated. |
getBase() | Validator | Returns the base path of this validator. |
getBaseKeys() | Validator | Returns the “keys” in the path of the base |
getContext() | Validator | Retrieve the current application context. |
getDependencyManager() | Validator | Returns the depency manager of the parent container if any. |
getFlatParameterNames() | ParameterHolder | Retrieve an array of flattened parameter names. |
getLastKey() | Validator | Returns the last “keys” in the path of the base |
getMutatedRequest() | Validator | The WebRequest this validator ended execute() with. |
getName() | Validator | Returns the name of this validator. |
getParameter() | ParameterHolder | Retrieve a parameter. |
getParameterNames() | ParameterHolder | Retrieve an array of parameter names. |
getParameters() | ParameterHolder | Retrieve an array of parameters. |
getParentContainer() | Validator | Retrieve the parent container. |
hasParameter() | ParameterHolder | Indicates whether or not a parameter exists. |
initialize() | BaseFileValidator | |
mapErrorCode() | Validator | Converts string severity codes into integer values (see severity constants) critical -> Validator::CRITICAL error -> Validator::ERROR notice -> Validator::NOTICE none -> Validator::NONE success -> not allowed to be specified by the user. |
removeParameter() | ParameterHolder | Remove a parameter. |
reset() | Validator | Returns the validator to its uninitialized state for reuse across requests. |
setErrorMessage() | Validator | Sets an error message override for the given index (the empty string is the default/generic message). |
setParameter() | ParameterHolder | Set a parameter. |
setParameterByRef() | ParameterHolder | Set a parameter by reference. |
setParameters() | ParameterHolder | Set an array of parameters. |
setParametersByRef() | ParameterHolder | Set an array of parameters by reference. |
setParentContainer() | Validator | Sets the parent container. |
shutdown() | Validator | Shuts the validator down. |