API Documentation

Zend/Validate/File/ImageSize.php

Show: inherited
Table of Contents

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 24594 2012-01-05 21:27:01Z matthew $  

\Zend_Validate_File_ImageSize

Package: Zend\Validate

Validator 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

Constant  WIDTH_TOO_BIG = 'fileImageSizeWidthTooBig'

Const
string Error constants  
Constant  WIDTH_TOO_SMALL = 'fileImageSizeWidthTooSmall'
Constant  HEIGHT_TOO_BIG = 'fileImageSizeHeightTooBig'
Constant  HEIGHT_TOO_SMALL = 'fileImageSizeHeightTooSmall'
Constant  NOT_DETECTED = 'fileImageSizeNotDetected'
Constant  NOT_READABLE = 'fileImageSizeNotReadable'

Properties

Propertyprotectedinteger  $_height= ''

Detected height

Details
Type
integer
Propertyprotectedinteger  $_maxheight= ''

Maximum image height

Details
Type
integer
Propertyprotectedinteger  $_maxwidth= ''

Maximum image width

Details
Type
integer
Propertyprotectedarray  $_messageTemplates= 'array( self::WIDTH_TOO_BIG => "Maximum allowed width for image '%value%' should be '%maxwidth%' but '%width%' detected"'

Error message template
Default valuearray( self::WIDTH_TOO_BIG => "Maximum allowed width for image '%value%' should be '%maxwidth%' but '%width%' detected"Details
Type
array
Propertyprotectedarray  $_messageVariables= 'array( 'minwidth' => '_minwidth''

Error message template variables
Default valuearray( 'minwidth' => '_minwidth'Details
Type
array
Propertyprotectedinteger  $_minheight= ''

Minimum image height

Details
Type
integer
Propertyprotectedinteger  $_minwidth= ''

Minimum image width

Details
Type
integer
Propertyprotectedinteger  $_width= ''

Detected width

Details
Type
integer

Methods

methodpublic__construct( \Zend_Config|array $options ) : void

Sets validator options

Accepts the following option keys: - minheight - minwidth - maxheight - maxwidth

Parameters
Name Type Description
$options \Zend_Config|array
methodprotected_throw( string $file, string $errorType ) : false

Throws an error of the given type

Parameters
Name Type Description
$file string
$errorType string
Returns
Type Description
false
methodpublicgetImageHeight( ) : array

Returns the set image height sizes

Returns
Type Description
array
methodpublicgetImageMax( ) : array

Returns the set maximum image sizes

Returns
Type Description
array
methodpublicgetImageMin( ) : array

Returns the set minimum image sizes

Returns
Type Description
array
methodpublicgetImageWidth( ) : array

Returns the set image width sizes

Returns
Type Description
array
methodpublicisValid( 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

Parameters
Name Type Description
$value string

Real file to check for image size

$file array

File data from Zend_File_Transfer

Returns
Type Description
boolean
methodpublicsetImageHeight( array $options ) : \Zend_Validate_File_ImageSize

Sets the mimimum and maximum image height

Parameters
Name Type Description
$options array

The image height dimensions

Returns
Type Description
\Zend_Validate_File_ImageSize Provides a fluent interface
methodpublicsetImageMax( array $options ) : \Zend_Validate_StringLength

Sets the maximum image size

Parameters
Name Type Description
$options array

The maximum image dimensions

Returns
Type Description
\Zend_Validate_StringLength Provides a fluent interface
Throws
Exception Description
\Zend_Validate_Exception When maxwidth is smaller than minwidth
\Zend_Validate_Exception When maxheight is smaller than minheight
methodpublicsetImageMin( array $options ) : \Zend_Validate_File_ImageSize

Sets the minimum image size

Parameters
Name Type Description
$options array

The minimum image dimensions

Returns
Type Description
\Zend_Validate_File_ImageSize Provides a fluent interface
Throws
Exception Description
\Zend_Validate_Exception When minwidth is greater than maxwidth
\Zend_Validate_Exception When minheight is greater than maxheight
methodpublicsetImageWidth( array $options ) : \Zend_Validate_File_ImageSize

Sets the mimimum and maximum image width

Parameters
Name Type Description
$options array

The image width dimensions

Returns
Type Description
\Zend_Validate_File_ImageSize Provides a fluent interface
Documentation was generated by DocBlox 0.15.1.