Properties

$_background

$_background : string

Background color.

Type

string

$_capabilities

$_capabilities : array

Capabilites of this driver.

Type

array

$_data

$_data : \Horde_Stream

The current image data.

Type

\Horde_Stream

$_logger

$_logger : 

Logger.

Type

$_width

$_width : integer

The current width of the image data.

Type

integer

$_height

$_height : integer

The current height of the image data.

Type

integer

$_tmpdir

$_tmpdir : string

A directory for temporary files.

Type

string

$_loadedEffects

$_loadedEffects : array

Array containing available Effects

Type

array

$_type

$_type : string

What kind of images should ImageMagick generate? Defaults to 'png'.

Type

string

$_context

$_context : 

Cache the context

Type

Methods

__construct()

__construct(array  $params, array  $context = array()) 

Constructor.

Parameters

array $params

The image object parameters. Values include:

  • background: (string) The background color. DEFAULT: white.
  • data: (string) The image binary data.
  • height: (integer) The desired image height.
  • type: (string) The output image type (png, jpeg etc.). DEFAULT: png.
  • width: (integer) The desired image width.
array $context

The object context - configuration, injected objects:

  • logger: (Horde_Log_Logger) A logger.
  • tmpdir: [REQUIRED] (string) Temporary directory.

__call()

__call(  $method,   $args) 

Catch-all method so that we don't error out when calling an unsupported manipulation method.

Parameters

$method
$args

getCapabilities()

getCapabilities() : array

Returns the capabilities.

Returns

array —

A list of backend capabilities.

hasCapability()

hasCapability(string  $capability) : boolean

Checks the existence of a particular capability.

Parameters

string $capability

The capability to check for.

Returns

boolean —

True if the backend has this capability.

headers()

headers() 

Sends HTTP headers for the image.

getContentType()

getContentType() : string

Returns the MIME type for this image.

Returns

string —

The MIME type for this image.

getType()

getType() : string

Returns the image type.

Returns

string —

The type of this image (png, jpg, etc.).

setType()

setType(string  $type) : string

Sets the output image type.

Parameters

string $type

An image type (png, jpg, etc.)

Returns

string —

The previous image type.

brush()

brush(integer  $x, integer  $y, string  $color = 'black', string  $shape = 'square') 

Draws a shaped point at the specified (x,y) point.

Useful for scatter diagrams, debug points, etc. Draws squares, circles, diamonds, and triangles.

Parameters

integer $x

The x coordinate of the point to brush.

integer $y

The y coordinate of the point to brush.

string $color

The color to brush the point with.

string $shape

What brush to use? Defaults to a square.

reset()

reset() 

Resets the image data to defaults.

getDimensions()

getDimensions() : array

Returns the height and width of the current image data.

Returns

array —

An hash with 'width' containing the width, 'height' containing the height of the image.

loadString()

loadString(mixed  $image_data) 

Loads the image data from a string.

Parameters

mixed $image_data

The data to use for the image as a string, Horde_Stream, or stream resource.

loadFile()

loadFile(string  $filename) 

Loads the image data from a file.

Parameters

string $filename

The full path and filename to the file to load the image data from.

Throws

\Horde_Image_Exception

toFile()

toFile(  $data = null) : string

Saves image data to file.

If $data is false-ish, saves current image data after performing pending operations on the data. If $data contains raw image data, saves that data to file without regard for the current image data.

Parameters

$data

Throws

\Horde_Image_Exception

Returns

string —

Path to temporary file.

display()

display() 

Displays the current image.

raw()

raw(boolean  $convert = false, array  $options = array()) : string

Returns the raw data for this image.

Parameters

boolean $convert

If true, the image data will be returned in the target format, independently from any image operations.

array $options

Array of options:

  • stream: If true, return as a stream resource. DEFAULT: false.

Returns

string —

The raw image data.

addEffect()

addEffect(string  $type, array  $params) 

Attempts to apply requested effect to this image.

Parameters

string $type

The type of effect to apply.

array $params

Any parameters for the effect.

getLoadedEffects()

getLoadedEffects() 

Returns a list of available effects for this driver.

applyEffects()

applyEffects() 

Applies any effects in the effect queue.

getTmpDir()

getTmpDir() : string

Returns the current temporary directory.

Returns

string —

The current temporary directory.

clearGeometry()

clearGeometry() 

Utility function to zero out cached geometry information.

Shouldn't really be called from client code, but is needed since effects may need to clear these.

getImageAtIndex()

getImageAtIndex(integer  $index) : \Horde_Image_Base

Returns a specific image from the pages of images.

Parameters

integer $index

The index to return.

Returns

\Horde_Image_Base

The requested image

getImagePageCount()

getImagePageCount() : integer

Returns the number of image pages available in the image object.

Returns

integer —

The number of images.

_logDebug()

_logDebug(string  $message) 

Logs a message at debug level.

Parameters

string $message

The log message.

_logErr()

_logErr(string  $message) 

Logs a message at error level.

Parameters

string $message

The log message.