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

$_img

$_img : array

The array of pixel data.

Type

array

$_colorDepth

$_colorDepth : integer

Color depth (only 8 and 16 implemented).

Type

integer

$_colorType

$_colorType : integer

Color type (only 2 (true color) implemented).

Type

integer

$_compressionMethod

$_compressionMethod : integer

Compression method (0 is the only current valid value).

Type

integer

$_filterMethod

$_filterMethod : integer

Filter method (0 is the only current valid value).

Type

integer

$_interlaceMethod

$_interlaceMethod : integer

Interlace method (only 0 (no interlace) implemented).

Type

integer

Methods

__construct()

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

PNG image 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() : string

Returns the raw data for this image.

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_Png

Requests a specific image from the collection of images.

Parameters

integer $index

The index to return

Throws

\Horde_Image_Exception

Returns

\Horde_Image_Png

getImagePageCount()

getImagePageCount() : integer

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

Returns

integer —

The number of images.

rectangle()

rectangle(integer  $x, integer  $y, integer  $width, integer  $height, string  $color = 'black', string  $fill = 'none') 

Draws a rectangle.

Parameters

integer $x

The left x-coordinate of the rectangle.

integer $y

The top y-coordinate of the rectangle.

integer $width

The width of the rectangle.

integer $height

The height of the rectangle.

string $color

The line color of the rectangle.

string $fill

The color to fill the rectangle.

_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.

_header()

_header() 

Creates the PNG file header.

_IHDR()

_IHDR() 

Creates the IHDR block.

_IEND()

_IEND() 

Creates the IEND block.

_IDAT()

_IDAT() 

Creates the IDAT block.

_tEXt()

_tEXt(  $keyword,   $text) 

Creates the tEXt block.

Parameters

$keyword
$text

_tIME()

_tIME(integer  $date = null) 

Creates the tIME block.

Parameters

integer $date

A timestamp.

_Adler32()

_Adler32(  $input) 

Calculates an Adler32 checksum for a string.

Parameters

$input