Zeta Components - high quality PHP components

Zeta Components Manual :: Docs For Class ezcImageGdBaseHandler

ImageConversion::ezcImageGdBaseHandler

Class ezcImageGdBaseHandler

ezcImageHandler implementation for the GD2 extension of PHP.

This class only implements the base funtionality of handling GD images. If you want to manipulate images using ext/GD in your application, you should use the ezcImageGdHandler.

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

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

ezcImageMethodcallHandler
   |
   --ezcImageGdBaseHandler
Version:   //autogentag//

Descendants

Child Class Description
ezcImageGdHandler ezcImageHandler implementation for the GD2 extension of PHP, including filters.

Method Summary

public static ezcImageHandlerSettings defaultSettings( )
Creates default settings for the handler and returns it.
public ezcImageGdBaseHandler __construct( $settings )
Create a new image handler.
public void close( $image )
Close the file referenced by $image.
public string load( $file , [ $mime = null] )
Load an image file.
protected void replaceTransparency( $image , $color )
Replaces a transparent background with the given color.
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 'GD'.

__construct

ezcImageGdBaseHandler __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.

Parameters:
Name Type Description
$settings ezcImageHandlerSettings Settings for the handler.
Exceptions:
Type Description
ezcImageHandlerNotAvailableException If the precondition for the handler is not fulfilled.

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.

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 given file does not exist.
ezcImageMimeTypeUnsupportedException If the type of the given file is not recognized
ezcImageFileNotProcessableException If the given file is not processable using this handler.
ezcImageFileNameInvalidException If an invalid character (", ', $) is found in the file name.

replaceTransparency

void replaceTransparency( mixed $image , $color )

Replaces a transparent background with the given color.

This method is used to replace the transparent background of an image with an opaque color when converting from a transparency supporting MIME type (e.g. image/png) to a MIME type that does not support transparency.

The color

Parameters:
Name Type Description
$image mixed
$color mixed

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
ezcImageFileNotProcessableException If the given file could not be saved with the given MIME type.
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