Zeta Components Manual :: Docs For Class ezcImageAnalyzerImagemagickHandler
ImageAnalysis::ezcImageAnalyzerImagemagickHandler
Class ezcImageAnalyzerImagemagickHandler
Class to retrieve information about a given image file.
This is an ezcImageAnalyzerHandler that utilizes ImageMagick to analyze image files.
This ezcImageAnalyzerHandler can be configured using the Option 'binary', which must be set to the full path of the ImageMagick "identify" binary. If this option is not submitted to the ezcImageAnalyzerHandler::__construct() method, the handler will use just the name of the binary ("identify" on Unix, "identify.exe" on Windows).
You can provide the options of the ezcImageAnalyzerImagemagickHandler to the ezcImageAnalyzer::setHandlerClasses().
Source for this file: /ImageAnalysis/src/handlers/imagemagick.php
ezcImageAnalyzerHandler | --ezcImageAnalyzerImagemagickHandler
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
|
Member Variables
protected string |
$binary
The ImageMagick binary to utilize. This variable is set during call to ezcImageAnalyzerImagemagickHandler::checkImagemagick(). |
protected bool |
$isAvailable
Indicates if this handler is available. The first call to ezcImageAnalyzerImagemagickHandler::isAvailable() determines this variable, which is then used as a cache for the call to ezcImageAnalyzerImagemagickHandler::checkImagemagick(). |
protected array(string=>string) |
$mimeMap
= array(
Mapping between ImageMagick identification strings and MIME types. ImageMagick's "identify" command returns an identification string to indicate the file type examined. This map has been handcrafted, because ImageMagick misses the possibility to determine MIME types. It misses some identification strings (mostly for file types which are absolutely rare in use or which ImageMagick is only capable to read or write, but not both.). |
protected array(string=>bool) |
$mimeTypes
= array(
MIME types this handler is capable to read. This array holds an extract of the ezcImageAnalyzerHandler::$mimeMap, listing all MIME types this handler is capable to analyze. The map is indexed by the MIME type, assigned to boolean true, to speed up hash lookups. |
Inherited Member Variables
From ezcImageAnalyzerHandler | |
---|---|
protected |
ezcImageAnalyzerHandler::$options
|
Method Summary
protected void |
analyzeExif(
$data
, $file
)
Analyze Exif data contained in JPEG and TIFF images. |
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. |
protected bool |
checkImagemagick(
)
Checks the availability of ImageMagick on the system. |
public bool |
isAvailable(
)
Checks wether the GD handler is available on the system. |
protected int |
runCommand(
$parameters
, &$stdOut
, &$errOut
, [ $stripNewlines
= true] , $stdOut
, $errOut
)
Run the binary registered in ezcImageAnalyzerImagemagickHandler::$binary. |
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
analyzeExif
Analyze Exif data contained in JPEG and TIFF images.
This method analyzes the Exif data contained in JPEG and TIFF images, using ImageMagick's "identify" binary.
This method tries to provide the EXIF data in a format as close as possible to the format returned by ext/EXIF http://php.net/exif.
Parameters:
Name | Type | Description |
---|---|---|
$data |
ezcImageAnalyzerData | The data object to fill. |
$file |
string | The file to analyze. |
analyzeImage
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 ezcImageAnalyzerImagemagickHandler.
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
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 ezcImageAnalyzerImagemagickHandler.
Parameters:
Name | Type | Description |
---|---|---|
$file |
string | The file to analyze. |
Redefinition of:
Method | Description |
---|---|
ezcImageAnalyzerHandler::analyzeType() |
Analyzes the image type. |
canAnalyze
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 ezcImageAnalyzerHandler::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. |
checkImagemagick
Checks the availability of ImageMagick on the system.
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. |
runCommand
Run the binary registered in ezcImageAnalyzerImagemagickHandler::$binary.
This method executes the ImageMagick binary using the applied parameter string. It returns the return value of the command. The output printed to STDOUT and ERROUT is available through the $stdOut and $errOut parameters.
Parameters:
Name | Type | Description |
---|---|---|
$parameters |
string | The parameters for the binary to execute. |
$stdOut |
string | The standard output. |
$errOut |
string | The error output. |
$stripNewlines |
bool | Wether to strip the newlines from STDOUT. |
&$stdOut |
||
&$errOut |