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

$_svg

$_svg : \XML_SVG

SVG document handle.

Type

\XML_SVG

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

Return raw image data.

Parameters

boolean $convert

Unused in SVG driver.

array $options

Array of options: NONE USED in SVG driver.

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.

text()

text(  $string, integer  $x, integer  $y, string  $font = 'monospace', string  $color = 'black', integer  $direction) 

Draws a text string on the image in a specified location, with the specified style information.

Parameters

$string
integer $x

The left x coordinate of the start of the text string.

integer $y

The top y coordinate of the start of the text string.

string $font

The font identifier you want to use for the text.

string $color

The color that you want the text displayed in.

integer $direction

An integer that specifies the orientation of the text.

circle()

circle(integer  $x, integer  $y, integer  $r, string  $color, string  $fill = null) 

Draws a circle.

Parameters

integer $x

The x coordinate of the centre.

integer $y

The y coordinate of the centre.

integer $r

The radius of the circle.

string $color

The line color of the circle.

string $fill

The color to fill the circle.

polygon()

polygon(  $verts, string  $color, string  $fill = null) 

Draws a polygon based on a set of vertices.

Parameters

$verts
string $color

The color you want to draw the polygon with.

string $fill

The color to fill the polygon.

rectangle()

rectangle(integer  $x, integer  $y, integer  $width, integer  $height, string  $color, string  $fill = null) 

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.

roundedRectangle()

roundedRectangle(integer  $x, integer  $y, integer  $width, integer  $height, integer  $round, string  $color, string  $fill) 

Draws a rounded 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.

integer $round

The width of the corner rounding.

string $color

The line color of the rectangle.

string $fill

The color to fill the rounded rectangle with.

line()

line(integer  $x1, integer  $y1,   $x2,   $y2, string  $color = 'black', string  $width = 1) 

Draws a line.

Parameters

integer $x1

The x coordinate of the end.

integer $y1

The y coordinate of the end.

$x2
$y2
string $color

The line color.

string $width

The width of the line.

dashedLine()

dashedLine(integer  $x1, integer  $y1,   $x2,   $y2, string  $color = 'black', string  $width = 1, integer  $dash_length = 2, integer  $dash_space = 2) 

Draws a dashed line.

Parameters

integer $x1

The x coordinate of the end.

integer $y1

The y coordinate of the end.

$x2
$y2
string $color

The line color.

string $width

The width of the line.

integer $dash_length

The length of a dash on the dashed line

integer $dash_space

The length of a space in the dashed line

polyline()

polyline(  $verts, string  $color, string  $width = 1) 

Draws a polyline (a non-closed, non-filled polygon) based on a set of vertices.

Parameters

$verts
string $color

The color you want to draw the line with.

string $width

The width of the line.

arc()

arc(integer  $x, integer  $y, integer  $r, integer  $start, integer  $end, string  $color = 'black', string  $fill = null) 

Draws an arc.

Parameters

integer $x

The x coordinate of the centre.

integer $y

The y coordinate of the centre.

integer $r

The radius of the arc.

integer $start

The start angle of the arc.

integer $end

The end angle of the arc.

string $color

The line color of the arc.

string $fill

The fill color of the arc (defaults to none).

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

_createSymbol()

_createSymbol(  $s,   $id) 

Parameters

$s
$id

_createDropShadow()

_createDropShadow(  $id = 'dropShadow') 

Parameters

$id