## Apache Zeta Components Manual :: Docs For Class ezcImageImagemagickBaseHandler

### ImageConversion::ezcImageImagemagickBaseHandler

### Class ezcImageImagemagickBaseHandler

ezcImageHandler implementation for ImageMagick.

This class only implements the base funtionality of handling images with ImageMagick. If you want to manipulate images using ImageMagick in your application, you should use the ezcImageImagemagickHandler.

You can use this base class to implement your own filter set on basis of ImageMagick, but you can also use ezcImageImagemagickHandler for this and profit from its already implemented filters.

Source for this file: /ImageConversion/src/handlers/imagemagick_base.php

    ezcImageMethodcallHandler
       |
       --ezcImageImagemagickBaseHandler

Version: | //autogentag//

### Descendants

Child Class | Description
--- | ---
ezcImageImagemagickHandler | ezcImageHandler implementation for ImageMagick.

### Method Summary

public static ezcImageHandlerSettings | `defaultSettings( )` Creates default settings for the handler and returns it.
public ezcImageImagemagickBaseHandler | `__construct( $settings )` Create a new image handler.
protected void | `addCompositeImage( $reference , $file )` Add an image to composite with the given reference.
protected void | `addFilterOption( $reference , $name , [ $parameter = null] )` Add a filter option to a given reference
public void | `close( $image )` Close the file referenced by $image.
protected void | `colorArrayToString( $color )` Returns a string representation of the given color array.
public string | `load( $file , [ $mime = null] )` Load an image file.
public void | `save( $image , [ $newFile = null] , [ $mime = null] , [ $options = null] )` Save an image file.

### Methods

#### defaultSettings

static ezcImageHandlerSettings defaultSettings( )

Creates default settings for the handler and returns it.

The reference name will be set to 'ImageMagick'.

#### __construct

ezcImageImagemagickBaseHandler __construct( ezcImageHandlerSettings $settings )

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 reference through manager afterwards.

This handler has an option 'binary' available, which allows you to explicitly set the path to your ImageMagicks "convert" binary (this may be necessary on Windows, since there may be an obscure "convert.exe" in the $PATH variable available, which has nothing to do with ImageMagick).

##### Parameters:

Name | Type | Description
--- | --- | ---
`$settings` | ezcImageHandlerSettings | Settings for the handler.

##### Exceptions:

Type | Description
--- | ---
`ezcImageHandlerNotAvailableException` | If the ImageMagick binary is not found.

#### addCompositeImage

void addCompositeImage( string $reference , string $file )

Add an image to composite with the given reference.

##### Parameters:

Name | Type | Description
--- | --- | ---
`$reference` | string | The reference to add an image to
`$file` | string | The file to composite with the image.

#### addFilterOption

void addFilterOption( string $reference , string $name , [string $parameter = null] )

Add a filter option to a given reference

##### Parameters:

Name | Type | Description
--- | --- | ---
`$reference` | string | The reference to add a filter for.
`$name` | string | The option name.
`$parameter` | string | The option parameter.

#### close

void close( 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.

#### colorArrayToString

void colorArrayToString( $color )

Returns a string representation of the given color array.

ImageConversion uses arrays to represent color values, in the format:

1. array(
2. 255,
3. 0,
4. 0,
5. )

This array represents the color red.

This method takes such a color array and converts it into a string representation usable by the convert binary. For the above examle it would be '#FF0000'.

##### Parameters:

Name | Type | Description
--- | --- | ---
`$color` | array |

##### Exceptions:

Type | Description
--- | ---
`ezcBaseValueException` | if one of the color values in the array is invalid (not integer, smaller than 0 or larger than 255).

#### load

string load( string $file , [string $mime = null] )

Load an image file.

Loads an image file and returns a reference to it.

##### Parameters:

Name | Type | Description
--- | --- | ---
`$file` | string | File to load.
`$mime` | string | The MIME type of the file.

##### Exceptions:

Type | Description
--- | ---
`ezcBaseFileNotFoundException` | If the desired file does not exist.
`ezcImageMimeTypeUnsupportedException` | If the desired file has a not recognized type.
`ezcImageFileNameInvalidException` | If an invalid character (", ', $) is found in the file name.

#### save

void save( string $image , [string $newFile = null] , [string $mime = null] , [ezcImageSaveOptions $options = null] )

Save an image file.

Saves a given open file. Can optionally save to a new file name.

##### Parameters:

Name | Type | Description
--- | --- | ---
`$image` | string | File reference created through load().
`$newFile` | string | Filename to save the image to.
`$mime` | string | New MIME type, if differs from initial one.
`$options` | ezcImageSaveOptions | Save options.

##### Exceptions:

Type | Description
--- | ---
`ezcBaseFilePermissionException` | If the desired file exists and is not writeable.
`ezcImageMimeTypeUnsupportedException` | If the desired MIME type is not recognized.
`ezcImageFileNameInvalidException` | If an invalid character (", ', $) is found in the file name.

Documentation generated by phpDocumentor 1.4.3