Zeta Components - high quality PHP components

Zeta Components Manual :: Docs For Class ezcImageAnalyzerPhpHandler

ImageAnalysis::ezcImageAnalyzerPhpHandler

Class ezcImageAnalyzerPhpHandler

Class to retrieve information about a given image file.

This handler implements image analyzation using direct PHP functionality, mainly the http://www.php.net/getimagesize function and, if available, the EXIF extension http://www.php.net/exif_read_data. The driver is capable of determining the type the following file formats:

  • GIF
  • JPG
  • PNG
  • SWF
  • SWC
  • PSD
  • TIFF
  • BMP
  • IFF
  • JP2
  • JPX
  • JB2
  • JPC
  • XBM
  • WBMP
The driver determines the MIME type of these images (using the ezcImageAnalyzerPhpHandler::analyzeType() method). The width, height and size of the given image are always available after analyzing a file, if the file in general can be analyzed ezcImageAnalyzerPhpHandler::canAnalyze().

For JPEG and TIFF images this driver will try to read in information using the EXIF extension in PHP and fills in the following properties of the ezcImageAnalyzerData struct, returned by the ezcImageAnalyzerPhpHandler::analyzeImage() method:

  • exif
  • isColor
  • comment
  • copyright
  • date
  • hasThumbnail
  • isAnimated
For GIF (also animated) it finds information by scanning the file manually and fills in the following properties of the ezcImageAnalyzerData struct, returned by the ezcImageAnalyzerPhpHandler::analyzeImage() method:
  • mode
  • transparencyType
  • comment
  • commentList
  • colorCount
  • isAnimated

Source for this file: /ImageAnalysis/src/handlers/php.php

ezcImageAnalyzerHandler
   |
   --ezcImageAnalyzerPhpHandler
Version:   //autogentag//

Inherited Constants

From ezcImageAnalyzerHandler:
ezcImageAnalyzerHandler::MODE_INDEXED    Image is built with a palette and consists of indexed values per pixel.
ezcImageAnalyzerHandler::MODE_TRUECOLOR    Image consists of RGB value per pixel.
ezcImageAnalyzerHandler::TRANSPARENCY_OPAQUE    No parts of image is transparent.
ezcImageAnalyzerHandler::TRANSPARENCY_TRANSLUCENT    Transparency determined pixel per pixel with a fuzzy value.
ezcImageAnalyzerHandler::TRANSPARENCY_TRANSPARENT

Inherited Member Variables

From ezcImageAnalyzerHandler
protected ezcImageAnalyzerHandler::$options

Method Summary

public ezcImageAnalyzerData analyzeImage( $file )
Analyze the image for detailed information.
public string|bool analyzeType( $file )
Analyzes the image type.
public bool canAnalyze( $mime )
Returns if the handler can analyze a given MIME type.
public bool isAvailable( )
Checks wether the GD handler is available on the system.

Inherited Methods

From ezcImageAnalyzerHandler
public ezcImageAnalyzerHandler ezcImageAnalyzerHandler::__construct()
Create an ezcImageAnalyzerHandler to analyze a file.
public abstract ezcImageAnalyzerData ezcImageAnalyzerHandler::analyzeImage()
Analyze the image for detailed information.
public abstract string|bool ezcImageAnalyzerHandler::analyzeType()
Analyzes the image type.
public abstract bool ezcImageAnalyzerHandler::canAnalyze()
Returns if the handler can analyze a given MIME type.
public abstract bool ezcImageAnalyzerHandler::isAvailable()
Checks wether the given handler is available for analyzing images.

Methods

analyzeImage

ezcImageAnalyzerData analyzeImage( string $file )

Analyze the image for detailed information.

This may return various information about the image, depending on it's type. All information is collected in the struct ezcImageAnalyzerData. At least the ezcImageAnalyzerData::$mime attribute is always available, if the image type can be analyzed at all. Additionally this handler will always set the ezcImageAnalyzerData::$width, ezcImageAnalyzerData::$height and ezcImageAnalyzerData::$size attributes. For detailes information on the additional data returned, see ezcImageAnalyzerPhpHandler.

Parameters:
Name Type Description
$file string The file to analyze.
Exceptions:
Type Description
ezcImageAnalyzerFileNotProcessableException If image file can not be processed.
Redefinition of:
Method Description
ezcImageAnalyzerHandler::analyzeImage() Analyze the image for detailed information.

analyzeType

string|bool analyzeType( string $file )

Analyzes the image type.

This method analyzes image data to determine the MIME type. This method returns the MIME type of the file to analyze in lowercase letters (e.g. "image/jpeg") or false, if the images MIME type could not be determined.

For a list of image types this handler will be able to analyze, see ezcImageAnalyzerPhpHandler.

Parameters:
Name Type Description
$file string The file to analyze.
Redefinition of:
Method Description
ezcImageAnalyzerHandler::analyzeType() Analyzes the image type.

canAnalyze

bool canAnalyze( string $mime )

Returns if the handler can analyze a given MIME type.

This method returns if the driver is capable of analyzing a given MIME type. This method should be called before trying to actually analyze an image using the drivers self::analyzeImage() method.

Parameters:
Name Type Description
$mime string The MIME type to check for.
Redefinition of:
Method Description
ezcImageAnalyzerHandler::canAnalyze() Returns if the handler can analyze a given MIME type.

isAvailable

bool isAvailable( )

Checks wether the GD handler is available on the system.

Returns if PHP's http://www.php.net/getimagesize function is available.

Redefinition of:
Method Description
ezcImageAnalyzerHandler::isAvailable() Checks wether the given handler is available for analyzing images.
Documentation generated by phpDocumentor 1.4.3