ImageConversion: ezcImageHandler
[ ]
[ ]
[ ]
[ ]
[ ]
Class: ezcImageHandler
|
Driver interface to access different image manipulation backends of PHP. [
source]
This interface has to be implemented by a handler class in order to be used with the ImageConversion package.
Member Variables
Method Summary
|
public ezcImageHandler |
__construct(
$settings, $settings
)
Create a new image handler. |
|
public abstract bool |
allowsInput(
$mime )
Check wether a specific MIME type is allowed as input for this handler. |
|
public abstract bool |
allowsOutput(
$mime )
Checks wether a specific MIME type is allowed as output for this handler. |
|
public abstract void |
applyFilter(
$image, $filter )
Applies a filter to a given image. |
|
public abstract void |
close(
$reference, $image )
Close the file referenced by $image. |
|
public abstract void |
convert(
$image, $mime )
Converts an image to another MIME type. |
|
public abstract array(string) |
getFilterNames(
)
Returns a list of filters this handler provides. |
|
public abstract bool |
hasFilter(
$name )
Checks if a given filter is available in this handler. |
|
public abstract string |
load(
$file, [$mime = null] )
Load an image file. |
|
public abstract void |
save(
$image, [$newFile = null], [$mime = null] )
Save an image file. |
|
public mixed |
__get(
$name )
Returns the property $name. |
|
public bool |
__isset(
$name )
Checks if the property $name exist and returns the result. |
|
public void |
__set(
$name, $value )
Sets the property $name to $value. |
Methods
__construct
Create a new image handler.
Creates an image handler. This should never be done directly, but only through the manager for configuration reasons. One can get a direct refernce through manager afterwards. When overwriting the constructor.
Parameters
allowsInput
bool allowsInput(
string
$mime )
Check wether a specific MIME type is allowed as input for this handler.
Parameters
| Name |
Type |
Description |
$mime |
string |
MIME type to check if it's allowed. |
allowsOutput
bool allowsOutput(
string
$mime )
Checks wether a specific MIME type is allowed as output for this handler.
Parameters
| Name |
Type |
Description |
$mime |
string |
MIME type to check if it's allowed. |
applyFilter
Applies a filter to a given image.
Parameters
| Name |
Type |
Description |
$image |
string |
Image reference to apply the filter on. |
$filter |
ezcImageFilter |
Contains which filter operation to apply. |
Throws
| Class | Description |
ezcImageFiltersException |
If the desired filter does not exist. ezcImageFiltersException::NOT_AVAILABLE. |
ezcImageMissingFilterParameterException |
If a parameter for the filter is missing. |
ezcImageFilterFailedException |
If the operation performed by the the filter failed. |
ezcBaseValueException |
If a parameter was not within the expected range. |
See also:
ezcImageHandler::save(),
ezcImageHandler::load().
close
void close(
$reference, string
$image )
Close the file referenced by $image.
Frees the image reference. You should call close() before.
Parameters
| Name |
Type |
Description |
$image |
string |
The image reference. |
$reference |
|
|
See also:
ezcImageHandler::save(),
ezcImageHandler::load().
convert
void convert(
string
$image, string
$mime )
Converts an image to another MIME type.
Parameters
| Name |
Type |
Description |
$image |
string |
Image reference to convert. |
$mime |
string |
MIME type to convert to. |
Throws
| Class | Description |
ezcImageMimeTypeUnsupportedException |
If the given MIME type is not supported by the filter. |
See also:
ezcImageHandler::save(),
ezcImageHandler::load().
getFilterNames
array(string) getFilterNames(
)
Returns a list of filters this handler provides.
The list returned is in format:
1. array(
2. 0 => <string filtername>,
3. 1 => <string filtername>,
4. ...
5. )
hasFilter
bool hasFilter(
string
$name )
Checks if a given filter is available in this handler.
Parameters
| Name |
Type |
Description |
$name |
string |
Name of the filter to check for. |
load
string load(
string
$file, [string
$mime = null] )
Load an image file.
Loads an image file and returns a reference to it.
For developers: The use of ezcImageHandler::loadCommon() is highly recommended for the implementation of this method!
Parameters
| Name |
Type |
Description |
$file |
string |
File to load. |
$mime |
string |
The MIME type of the file. |
save
void save(
string
$image, [string
$newFile = null], [string
$mime = null] )
Save an image file.
Saves a given open file. Can optionally save to a new file name. The image reference is not freed automatically, so you need to call the close() method explicitly to free the referenced data.
Parameters
| Name |
Type |
Description |
$image |
string |
File reference created through. |
$newFile |
string |
Filename to save the image to. |
$mime |
string |
New MIME type, if differs from initial one. |
See also:
ezcImageHandler::close(),
ezcImageHandler::load().
__get
mixed __get(
string
$name )
Returns the property $name.
Parameters
| Name |
Type |
Description |
$name |
string |
|
Throws
| Class | Description |
ezcBasePropertyNotFoundException |
if the property does not exist. |
__isset
bool __isset(
string
$name )
Checks if the property $name exist and returns the result.
Parameters
| Name |
Type |
Description |
$name |
string |
|
__set
void __set(
string
$name, mixed
$value )
Sets the property $name to $value.
Parameters
| Name |
Type |
Description |
$name |
string |
|
$value |
mixed |
|
Throws
| Class | Description |
ezcBasePropertyNotFoundException |
if the property does not exist. |
ezcBasePropertyReadOnlyException |
if the property cannot be modified. |
Last updated: Thu, 31 Jan 2008