Zeta Components Manual :: Docs For Class ezcImageAnalyzerHandler
ImageAnalysis::ezcImageAnalyzerHandler
Class ezcImageAnalyzerHandler
This base class has to be extended by all ezcImageAnalyzerHandler classes.
An object of an ezcImageAnalyzerHandler class must implement this interface to work properly as a handler for ezcImageAnalyzer.
Source for this file: /ImageAnalysis/src/interfaces/handler.php
Version: | //autogentag// |
Descendants
Child Class | Description |
---|---|
ezcImageAnalyzerPhpHandler | Class to retrieve information about a given image file. |
ezcImageAnalyzerImagemagickHandler | Class to retrieve information about a given image file. |
Constants
MODE_INDEXED
= 1
|
Image is built with a palette and consists of indexed values per pixel. |
MODE_TRUECOLOR
= 2
|
Image consists of RGB value per pixel. |
TRANSPARENCY_OPAQUE
= 1
|
No parts of image is transparent. |
TRANSPARENCY_TRANSLUCENT
= 3
|
Transparency determined pixel per pixel with a fuzzy value. |
TRANSPARENCY_TRANSPARENT
= 2
|
Member Variables
protected array(string=>mixed) |
$options
= array()
Options for the handler. Usually this is empty, but some handlers need special options e.g. ezcImageAnalyzerImagemagickHandler. |
Method Summary
public ezcImageAnalyzerHandler |
__construct(
[ $options
= array()] )
Create an ezcImageAnalyzerHandler to analyze a file. |
public abstract ezcImageAnalyzerData |
analyzeImage(
$file
)
Analyze the image for detailed information. |
public abstract string|bool |
analyzeType(
$file
)
Analyzes the image type. |
public abstract bool |
canAnalyze(
$mime
)
Returns if the handler can analyze a given MIME type. |
public abstract bool |
isAvailable(
)
Checks wether the given handler is available for analyzing images. |
Methods
__construct
Create an ezcImageAnalyzerHandler to analyze a file.
The constructor can optionally receive an array of options. Which options are utilized by the handler depends on it's implementation. To determine this, please refer to the specific handler.
Parameters:
Name | Type | Description |
---|---|---|
$options |
array | Possible options for the handler. |
Exceptions:
Type | Description |
---|---|
ezcImageAnalyzerException |
If the handler is not able to work. |
analyzeImage
Analyze the image for detailed information.
This may return various information about the image, depending on it's type and the implemented facilities of the handler. All information is collected in the struct ezcImageAnalyzerData. Which information is set about an image in the returned data struct, depends on the image type and the capabilities of the handler. At least the ezcImageAnalyzerData::$mime attribute must be set. Most handlers also provide additional information like the image dimensions and the size of the image file.
Parameters:
Name | Type | Description |
---|---|---|
$file |
string | The file to analyze. |
Exceptions:
Type | Description |
---|---|
ezcImageAnalyzerFileNotProcessableException |
If image file can not be processed. |
Redefined in descendants as:
Method | Description |
---|---|
ezcImageAnalyzerPhpHandler::analyzeImage() |
Analyze the image for detailed information. |
ezcImageAnalyzerImagemagickHandler::analyzeImage() |
Analyze the image for detailed information. |
analyzeType
Analyzes the image type.
This method analyzes image data to determine the MIME type. Each ezcImageAnalyzerHandler must at least be capable of performing this operation on a file. This method has to return 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.
Parameters:
Name | Type | Description |
---|---|---|
$file |
string | The file to analyze. |
Redefined in descendants as:
Method | Description |
---|---|
ezcImageAnalyzerPhpHandler::analyzeType() |
Analyzes the image type. |
ezcImageAnalyzerImagemagickHandler::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 self::analyzeImage() method.
Parameters:
Name | Type | Description |
---|---|---|
$mime |
string | The MIME type to check for. |
Redefined in descendants as:
Method | Description |
---|---|
ezcImageAnalyzerPhpHandler::canAnalyze() |
Returns if the handler can analyze a given MIME type. |
ezcImageAnalyzerImagemagickHandler::canAnalyze() |
Returns if the handler can analyze a given MIME type. |
isAvailable
Checks wether the given handler is available for analyzing images.
Each ezcImageAnalyzerHandler must implement this method in order to check if the handler is available on the system. The method has to return true, if the handle is currently available to analyze images (e.g. if the GD extension is available, for the ezcImageAnalyzerPhpHandler).
Redefined in descendants as:
Method | Description |
---|---|
ezcImageAnalyzerPhpHandler::isAvailable() |
Checks wether the GD handler is available on the system. |
ezcImageAnalyzerImagemagickHandler::isAvailable() |
Checks wether the GD handler is available on the system. |