Skip to content


Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Fetching contributors…

Cannot retrieve contributors at this time

114 lines (105 sloc) 3.346 kb
* Zend Framework (
* @link for the canonical source repository
* @copyright Copyright (c) 2005-2013 Zend Technologies USA Inc. (
* @license New BSD License
namespace Zend\Validator\File;
use Traversable;
use Zend\Stdlib\ArrayUtils;
* Validator which checks if the file already exists in the directory
class IsImage extends MimeType
* @const string Error constants
const FALSE_TYPE = 'fileIsImageFalseType';
const NOT_DETECTED = 'fileIsImageNotDetected';
const NOT_READABLE = 'fileIsImageNotReadable';
* @var array Error message templates
protected $messageTemplates = array(
self::FALSE_TYPE => "File is no image, '%type%' detected",
self::NOT_DETECTED => "The mimetype could not be detected from the file",
self::NOT_READABLE => "File is not readable or does not exist",
* Sets validator options
* @param array|Traversable|string $options
public function __construct($options = array())
$default = array(
if ($options instanceof Traversable) {
$options = ArrayUtils::iteratorToArray($options);
if (empty($options)) {
$options = array('mimeType' => $default);
Jump to Line
Something went wrong with that request. Please try again.