Public Member Functions | Data Fields | Protected Member Functions | Protected Attributes

Zend_Validate_File_ImageSize Class Reference

Inheritance diagram for Zend_Validate_File_ImageSize:
Zend_Validate_Abstract Zend_Validate_Interface

Public Member Functions

 __construct ($options)
 getImageMin ()
 getImageMax ()
 getImageWidth ()
 getImageHeight ()
 setImageMin ($options)
 setImageMax ($options)
 setImageWidth ($options)
 setImageHeight ($options)
 isValid ($value, $file=null)

Data Fields

const WIDTH_TOO_BIG = 'fileImageSizeWidthTooBig'
const WIDTH_TOO_SMALL = 'fileImageSizeWidthTooSmall'
const HEIGHT_TOO_BIG = 'fileImageSizeHeightTooBig'
const HEIGHT_TOO_SMALL = 'fileImageSizeHeightTooSmall'
const NOT_DETECTED = 'fileImageSizeNotDetected'
const NOT_READABLE = 'fileImageSizeNotReadable'

Protected Member Functions

 _throw ($file, $errorType)

Protected Attributes

 $_messageTemplates
 $_messageVariables
 $_minwidth
 $_maxwidth
 $_minheight
 $_maxheight
 $_width
 $_height

Detailed Description

Definition at line 35 of file ImageSize.php.


Constructor & Destructor Documentation

__construct ( options )

Sets validator options

Accepts the following option keys:

  • minheight
  • minwidth
  • maxheight
  • maxwidth
Parameters:
Zend_Config | array$options
Returns:
void

Definition at line 125 of file ImageSize.php.


Member Function Documentation

_throw ( file,
errorType 
) [protected]

Throws an error of the given type

Parameters:
string$file
string$errorType
Returns:
false

Definition at line 357 of file ImageSize.php.

getImageHeight (  )

Returns the set image height sizes

Returns:
array

Definition at line 193 of file ImageSize.php.

getImageMax (  )

Returns the set maximum image sizes

Returns:
array

Definition at line 173 of file ImageSize.php.

getImageMin (  )

Returns the set minimum image sizes

Returns:
array

Definition at line 163 of file ImageSize.php.

getImageWidth (  )

Returns the set image width sizes

Returns:
array

Definition at line 183 of file ImageSize.php.

isValid ( value,
file = null 
)

Defined by Zend_Validate_Interface

Returns true if and only if the imagesize of $value is at least min and not bigger than max

Parameters:
string$valueReal file to check for image size
array$fileFile data from Zend_File_Transfer
Returns:
boolean

Definition at line 310 of file ImageSize.php.

setImageHeight ( options )

Sets the mimimum and maximum image height

Parameters:
array$optionsThe image height dimensions
Returns:
Zend_Validate_File_ImageSize Provides a fluent interface

Definition at line 292 of file ImageSize.php.

setImageMax ( options )

Sets the maximum image size

Parameters:
array$optionsThe maximum image dimensions
Exceptions:
Zend_Validate_ExceptionWhen maxwidth is smaller than minwidth
Zend_Validate_ExceptionWhen maxheight is smaller than minheight
Returns:
Zend_Validate_StringLength Provides a fluent interface

Definition at line 243 of file ImageSize.php.

setImageMin ( options )

Sets the minimum image size

Parameters:
array$optionsThe minimum image dimensions
Exceptions:
Zend_Validate_ExceptionWhen minwidth is greater than maxwidth
Zend_Validate_ExceptionWhen minheight is greater than maxheight
Returns:
Zend_Validate_File_ImageSize Provides a fluent interface

Definition at line 206 of file ImageSize.php.

setImageWidth ( options )

Sets the mimimum and maximum image width

Parameters:
array$optionsThe image width dimensions
Returns:
Zend_Validate_File_ImageSize Provides a fluent interface

Definition at line 278 of file ImageSize.php.


Field Documentation

$_messageTemplates [protected]
Initial value:
 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     => "The image '%value%' can not be read"
    )

Reimplemented from Zend_Validate_Abstract.

Definition at line 50 of file ImageSize.php.

$_messageVariables [protected]
Initial value:
 array(
        'minwidth'  => '_minwidth',
        'maxwidth'  => '_maxwidth',
        'minheight' => '_minheight',
        'maxheight' => '_maxheight',
        'width'     => '_width',
        'height'    => '_height'
    )

Reimplemented from Zend_Validate_Abstract.

Definition at line 62 of file ImageSize.php.

const WIDTH_TOO_BIG = 'fileImageSizeWidthTooBig'

string Error constants

Definition at line 40 of file ImageSize.php.


The documentation for this class was generated from the following file: