Path

ez components / documentation / api reference / 2007.2.1 / image


eZ Components 2007.2.1

ImageAnalysis

[ Tutorial ] [ Class tree ] [ Element index ] [ ChangeLog ] [ Credits ]

Source for file analyzer_data.php

Documentation is available at analyzer_data.php

  1. <?php
  2. /**
  3.  * File containing the ezcImageAnalyzerData struct.
  4.  *
  5.  * @package ImageAnalysis
  6.  * @version 1.1.2
  7.  * @copyright Copyright (C) 2005-2007 eZ systems as. All rights reserved.
  8.  * @license http://ez.no/licenses/new_bsd New BSD License
  9.  * @filesource
 10.  */
 11.  
 12. /**
 13.  * Struct to store the data retrieved from an image analysis.
 14.  *
 15.  * This class is used as a struct for the data retrieved from
 16.  * an {@link ezcImageAnalyzerHandler}. It stores various information about
 17.  * an analyzed image and pre-fills it's attributes with sensible default
 18.  * values, to make the usage as easy as possible.
 19.  *
 20.  * Ths struct class should not be accessed directly (except form
 21.  * {@link ezcImageAnalyzerHandler} classes, where it is created). From a
 22.  * users view it is transparently accessable through
 23.  * {@link ezcImageAnalyzer::$data}, more specific using
 24.  * <code>
 25.  * $analyzer = new ezcImageAnalyzer( 'myfile.jpg' );
 26.  * echo $analyzer->data->size;
 27.  * </code>
 28.  *
 29.  * @see ezcImageAnalyzer
 30.  * @see ezcImageAnalyzerHandler
 31.  *
 32.  * @package ImageAnalysis
 33.  * @version 1.1.2
 34.  */
 35. class ezcImageAnalyzerData extends ezcBaseStruct
 36. {
 37.     /**
 38.      * Detected MIME type for the image.
 39.      *
 40.      * @var string 
 41.      */
 42.     public $mime;
 43.  
 44.     /**
 45.      * EXIF information retrieved from image.
 46.      *
 47.      * This will only be filled in for images which supports EXIF entries,
 48.      * currently they are:
 49.      * - image/jpeg
 50.      * - image/tiff
 51.      *
 52.      * @link http://php.net/manual/en/function.exif-read-data.php
 53.      *
 54.      * @var array(string=>string) 
 55.      */
 56.     public $exif = array();
 57.  
 58.     /**
 59.      * Width of image in pixels.
 60.      *
 61.      * @var int 
 62.      */
 63.     public $width = 0;
 64.  
 65.     /**
 66.      * Height of image in pixels.
 67.      *
 68.      * @var int 
 69.      */
 70.     public $height = 0;
 71.  
 72.     /**
 73.      * Size of image file in bytes.
 74.      *
 75.      * @var int 
 76.      */
 77.     public $size = 0;
 78.  
 79.     /**
 80.      * The image mode.
 81.      *
 82.      * Can be one of:
 83.      * - ezcImageAnalyzerHandler::MODE_INDEXED   - Image is built with a palette and consists of
 84.      *                          indexed values per pixel.
 85.      * - ezcImageAnalyzerHandler::MODE_TRUECOLOR - Image consists of RGB value per pixel.
 86.      *
 87.      * @var int 
 88.      */
 89.     public $mode = ezcImageAnalyzerHandler::MODE_TRUECOLOR;
 90.  
 91.     /**
 92.      * Type of transparency in image.
 93.      *
 94.      * Can be one of:
 95.      * - ezcImageAnalyzerHandler::TRANSPARENCY_OPAQUE      - No parts of image is transparent.
 96.      * - ezcImageAnalyzerHandler::TRANSPARENCY_TRANSPARENT - Selected palette entries are
 97.      *                                    completely see-through.
 98.      * - ezcImageAnalyzerHandler::TRANSPARENCY_TRANSLUCENT - Transparency determined pixel per
 99.      *                                    pixel with a fuzzy value.
100.      *
101.      * @var int 
102.      */
103.     public $transparencyType;
104.  
105.     /**
106.      * Does the image have colors?
107.      *
108.      * @var bool 
109.      */
110.     public $isColor = true;
111.  
112.     /**
113.      * Number of colors in image.
114.      *
115.      * @var int 
116.      */
117.     public $colorCount = 0;
118.  
119.     /**
120.      * First inline comment for the image.
121.      *
122.      * @var string 
123.      */
124.     public $comment = null;
125.  
126.     /**
127.      * List of inline comments for the image.
128.      *
129.      * @var array(string) 
130.      */
131.     public $commentList = array();
132.  
133.     /**
134.      * Copyright text for the image.
135.      *
136.      * @var string 
137.      */
138.     public $copyright = null;
139.  
140.     /**
141.      * The date when the picture was taken as UNIX timestamp.
142.      *
143.      * @var int 
144.      */
145.     public $date;
146.  
147.     /**
148.      * Does the image have a thumbnail?
149.      *
150.      * @var bool 
151.      */
152.     public $hasThumbnail = false;
153.  
154.     /**
155.      * Is the image animated?
156.      *
157.      * @var bool 
158.      */
159.     public $isAnimated = false;
160.  
161.     /**
162.      * Create a new instance of ezcImageAnalyzerData.
163.      *
164.      * Create a new instance of ezcImageAnalyzerData to be used with
165.      * {@link ezcImageAnalyzer} objects.
166.      *
167.      * @see ezcImageAnalyzer::analyzeImage()
168.      * @see ezcImageAnalyzerHandler::analyzeImage()
169.      *
170.      * @param string $mime {@link ezcImageAnalyzerData::$mime}
171.      * @param array $exif {@link ezcImageAnalyzerData::$exif}
172.      * @param int $width {@link ezcImageAnalyzerData::$width}
173.      * @param int $height {@link ezcImageAnalyzerData::$height}
174.      * @param int $size {@link ezcImageAnalyzerData::$size}
175.      * @param int $mode {@link ezcImageAnalyzerData::$mode}
176.      * @param int $transparencyType {@link ezcImageAnalyzerData::$transparencyType}
177.      * @param bool $isColor {@link ezcImageAnalyzerData::$isColor}
178.      * @param int $colorCount {@link ezcImageAnalyzerData::$colorCount}
179.      * @param string $comment {@link ezcImageAnalyzerData::$comment}
180.      * @param array $commentList {@link ezcImageAnalyzerData::$commentList}
181.      * @param string $copyright {@link ezcImageAnalyzerData::$copyright}
182.      * @param int $date {@link ezcImageAnalyzerData::$date}
183.      * @param bool $hasThumbnail {@link ezcImageAnalyzerData::$hasThumbnail}
184.      * @param bool $isAnimated {@link ezcImageAnalyzerData::$isAnimated}
185.      */
186.     public function __construct(
187.         $mime null,
188.         $exif array(),
189.         $width 0,
190.         $height 0,
191.         $size 0,
192.         $mode ezcImageAnalyzerHandler::MODE_TRUECOLOR,
193.         $transparencyType null,
194.         $isColor true,
195.         $colorCount 0,
196.         $comment null,
197.         $commentList array(),
198.         $copyright null,
199.         $date null,
200.         $hasThumbnail false,
201.         $isAnimated false
202.     )
203.     {
204.         $this->mime = $mime;
205.         $this->exif = $exif;
206.         $this->width = $width;
207.         $this->height = $height;
208.         $this->size = $size;
209.         $this->mode = $mode;
210.         $this->transparencyType = $transparencyType;
211.         $this->isColor = $isColor;
212.         $this->colorCount = $colorCount;
213.         $this->comment = $comment;
214.         $this->commentList = $commentList;
215.         $this->copyright = $copyright;
216.         $this->date = $date;
217.         $this->hasThumbnail = $hasThumbnail;
218.         $this->isAnimated = $isAnimated;
219.     }
220. }
221. ?>
Last updated: Thu, 31 Jan 2008