Validate/File/ImageSize.php
Zend Framework
LICENSE
This source file is subject to the new BSD license that is bundled
with this package in the file LICENSE.txt.
It is also available through the world-wide-web at this URL:
http://framework.zend.com/license/new-bsd
If you did not receive a copy of the license and are unable to
obtain it through the world-wide-web, please send an email
to license@zend.com so we can send you a copy immediately.
- Category
- Zend
- Copyright
- Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
- License
- New BSD License
- Package
- Zend_Validate
- Version
- $Id: ImageSize.php 24593 2012-01-05 20:35:02Z matthew $
\Zend_Validate_File_ImageSize
Package: Zend\ValidateValidator for the image size of a image file
- Parent(s)
- \Zend_Validate_Abstract
- Category
- Zend
- Copyright
- Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
- License
- New BSD License
Constants


WIDTH_TOO_BIG
= 'fileImageSizeWidthTooBig'
- Const
- string Error constants


WIDTH_TOO_SMALL
= 'fileImageSizeWidthTooSmall'


HEIGHT_TOO_BIG
= 'fileImageSizeHeightTooBig'


HEIGHT_TOO_SMALL
= 'fileImageSizeHeightTooSmall'


NOT_DETECTED
= 'fileImageSizeNotDetected'


NOT_READABLE
= 'fileImageSizeNotReadable'
Properties



array $_messageTemplates = array(self::WIDTH_TOO_BIG => "Maximum allowed width for image '%value%' should be '%maxwidth%' but '%width%' detected", self::WIDTH_TOO_SMALL => "Minimum expected width for image '%value%' should be '%minwidth%' but '%width%' detected", self::HEIGHT_TOO_BIG => "Maximum allowed height for image '%value%' should be '%maxheight%' but '%height%' detected", self::HEIGHT_TOO_SMALL => "Minimum expected height for image '%value%' should be '%minheight%' but '%height%' detected", self::NOT_DETECTED => "The size of image '%value%' could not be detected", self::NOT_READABLE => "File '%value%' is not readable or does not exist")
Validation failure message template definitions
Default valuearray(self::WIDTH_TOO_BIG => "Maximum allowed width for image '%value%' should be '%maxwidth%' but '%width%' detected", self::WIDTH_TOO_SMALL => "Minimum expected width for image '%value%' should be '%minwidth%' but '%width%' detected", self::HEIGHT_TOO_BIG => "Maximum allowed height for image '%value%' should be '%maxheight%' but '%height%' detected", self::HEIGHT_TOO_SMALL => "Minimum expected height for image '%value%' should be '%minheight%' but '%height%' detected", self::NOT_DETECTED => "The size of image '%value%' could not be detected", self::NOT_READABLE => "File '%value%' is not readable or does not exist")
Details- Type
- array



array $_messageVariables = array('minwidth' => '_minwidth', 'maxwidth' => '_maxwidth', 'minheight' => '_minheight', 'maxheight' => '_maxheight', 'width' => '_width', 'height' => '_height')
Additional variables available for validation failure messages
Default valuearray('minwidth' => '_minwidth', 'maxwidth' => '_maxwidth', 'minheight' => '_minheight', 'maxheight' => '_maxheight', 'width' => '_width', 'height' => '_height')
Details- Type
- array
Methods



__get(string $property) : mixed
inheritedMagic function returns the value of the requested property, if and only if it is the value or a
message variable.
Inherited from:
\Zend_Validate_Abstract::__get() ParametersName | Type | Description |
---|
$property | string | |
---|
ReturnsThrows 


_createMessage(string $messageKey, string $value) : string
Returns null if and only if $messageKey does not correspond to an existing template.
If a translator is available and a translation exists for $messageKey,
the translation will be used.
ParametersName | Type | Description |
---|
$messageKey | string | |
---|
$value | string | |
---|
Returns


_error(string $messageKey, string $value = null) : void
ParametersName | Type | Description |
---|
$messageKey | string | |
---|
$value | string | OPTIONAL |
---|



_throw(string $file, string $errorType) : false
Throws an error of the given type
ParametersName | Type | Description |
---|
$file | string | |
---|
$errorType | string | |
---|
Returns 


getMessages() : array
The array keys are validation failure message identifiers,
and the array values are the corresponding human-readable message strings.
If isValid() was never called or if the most recent isValid() call
returned true, then this method returns an empty array.
Returns


isValid(string $value, array $file = null) : boolean
Defined by Zend_Validate_Interface
Returns true if and only if the imagesize of $value is at least min and
not bigger than max
ParametersName | Type | Description |
---|
$value | string | Real file to check for image size |
---|
$file | array | File data from Zend_File_Transfer |
---|
ReturnsThrows


setImageHeight(array $options) : \Zend_Validate_File_ImageSize
Sets the mimimum and maximum image height
ParametersName | Type | Description |
---|
$options | array | The image height dimensions |
---|
Returns 


setImageMax(array $options) : \Zend_Validate_StringLength
Sets the maximum image size
ParametersName | Type | Description |
---|
$options | array | The maximum image dimensions |
---|
ReturnsThrows 


setImageMin(array $options) : \Zend_Validate_File_ImageSize
Sets the minimum image size
ParametersName | Type | Description |
---|
$options | array | The minimum image dimensions |
---|
ReturnsThrows 


setImageWidth(array $options) : \Zend_Validate_File_ImageSize
Sets the mimimum and maximum image width
ParametersName | Type | Description |
---|
$options | array | The image width dimensions |
---|
Returns 


setMessage(string $messageString, string $messageKey = null) : \Zend_Validate_Abstract
ParametersName | Type | Description |
---|
$messageString | string | |
---|
$messageKey | string | OPTIONAL |
---|
ReturnsThrows 


setMessages(array $messages) : \Zend_Validate_Abstract
inheritedSets validation failure message templates given as an array, where the array keys are the message keys,
and the array values are the message template strings.
Inherited from:
\Zend_Validate_Abstract::setMessages() ParametersName | Type | Description |
---|
$messages | array | |
---|
Returns