Added the zend framework 2 library, the path is specified in line no.26 in zend_modul...
[openemr.git] / interface / modules / zend_modules / library / Zend / Validator / File / IsImage.php
blob0f0e02a626014692ae0b7e2887cd03059a51a665
1 <?php
2 /**
3 * Zend Framework (http://framework.zend.com/)
5 * @link http://github.com/zendframework/zf2 for the canonical source repository
6 * @copyright Copyright (c) 2005-2013 Zend Technologies USA Inc. (http://www.zend.com)
7 * @license http://framework.zend.com/license/new-bsd New BSD License
8 */
10 namespace Zend\Validator\File;
12 use Traversable;
13 use Zend\Stdlib\ArrayUtils;
15 /**
16 * Validator which checks if the file already exists in the directory
18 class IsImage extends MimeType
20 /**
21 * @const string Error constants
23 const FALSE_TYPE = 'fileIsImageFalseType';
24 const NOT_DETECTED = 'fileIsImageNotDetected';
25 const NOT_READABLE = 'fileIsImageNotReadable';
27 /**
28 * @var array Error message templates
30 protected $messageTemplates = array(
31 self::FALSE_TYPE => "File is no image, '%type%' detected",
32 self::NOT_DETECTED => "The mimetype could not be detected from the file",
33 self::NOT_READABLE => "File is not readable or does not exist",
36 /**
37 * Sets validator options
39 * @param array|Traversable|string $options
41 public function __construct($options = array())
43 // http://de.wikipedia.org/wiki/Liste_von_Dateiendungen
44 // http://www.iana.org/assignments/media-types/image/
45 $default = array(
46 'application/cdf',
47 'application/dicom',
48 'application/fractals',
49 'application/postscript',
50 'application/vnd.hp-hpgl',
51 'application/vnd.oasis.opendocument.graphics',
52 'application/x-cdf',
53 'application/x-cmu-raster',
54 'application/x-ima',
55 'application/x-inventor',
56 'application/x-koan',
57 'application/x-portable-anymap',
58 'application/x-world-x-3dmf',
59 'image/bmp',
60 'image/c',
61 'image/cgm',
62 'image/fif',
63 'image/gif',
64 'image/jpeg',
65 'image/jpm',
66 'image/jpx',
67 'image/jp2',
68 'image/naplps',
69 'image/pjpeg',
70 'image/png',
71 'image/svg',
72 'image/svg+xml',
73 'image/tiff',
74 'image/vnd.adobe.photoshop',
75 'image/vnd.djvu',
76 'image/vnd.fpx',
77 'image/vnd.net-fpx',
78 'image/x-cmu-raster',
79 'image/x-cmx',
80 'image/x-coreldraw',
81 'image/x-cpi',
82 'image/x-emf',
83 'image/x-ico',
84 'image/x-icon',
85 'image/x-jg',
86 'image/x-ms-bmp',
87 'image/x-niff',
88 'image/x-pict',
89 'image/x-pcx',
90 'image/x-png',
91 'image/x-portable-anymap',
92 'image/x-portable-bitmap',
93 'image/x-portable-greymap',
94 'image/x-portable-pixmap',
95 'image/x-quicktime',
96 'image/x-rgb',
97 'image/x-tiff',
98 'image/x-unknown',
99 'image/x-windows-bmp',
100 'image/x-xpmi',
103 if ($options instanceof Traversable) {
104 $options = ArrayUtils::iteratorToArray($options);
107 if ($options === null) {
108 $options = array();
111 parent::__construct($options);
113 if (!$this->getMimeType()) {
114 $this->setMimeType($default);