PHP Class Horde_Image_Base, horde

Author: Chuck Hagenbuch ([email protected])
Author: Michael J. Rubinsky ([email protected])
Author: Jan Schneider ([email protected])
Inheritance: extends EmptyIterator
Mostrar archivo Open project: horde/horde Class Usage Examples

Protected Properties

Property Type Description
$_background string Background color.
$_capabilities array Capabilites of this driver.
$_context Cache the context
$_data string The current image data.
$_height integer The current height of the image data.
$_loadedEffects array Array containing available Effects
$_logger Logger.
$_tmpdir string A directory for temporary files.
$_type string What kind of images should ImageMagick generate? Defaults to 'png'.
$_width integer The current width of the image data.

Public Methods

Method Description
__call ( $method, $args ) Catch-all method so that we don't error out when calling an unsupported manipulation method.
addEffect ( string $type, array $params ) Attempts to apply requested effect to this image.
applyEffects ( ) Applies any effects in the effect queue.
brush ( integer $x, integer $y, string $color = 'black', string $shape = 'square' ) Draws a shaped point at the specified (x,y) point.
clearGeometry ( ) Utility function to zero out cached geometry information.
display ( ) Displays the current image.
getCapabilities ( ) : array Returns the capabilities.
getContentType ( ) : string Returns the MIME type for this image.
getDimensions ( ) : array Returns the height and width of the current image data.
getImageAtIndex ( integer $index ) : Horde_Image_Base Returns a specific image from the pages of images.
getImagePageCount ( ) : integer Returns the number of image pages available in the image object.
getLoadedEffects ( ) Returns a list of available effects for this driver.
getTmpDir ( ) : string Returns the current temporary directory.
getType ( ) : string Returns the image type.
hasCapability ( string $capability ) : boolean Checks the existence of a particular capability.
headers ( ) Sends HTTP headers for the image.
loadFile ( string $filename ) Loads the image data from a file.
loadString ( string $image_data ) Loads the image data from a string.
raw ( boolean $convert = false ) : string Returns the raw data for this image.
reset ( ) Resets the image data to defaults.
setType ( string $type ) : string Sets the output image type.
toFile ( $data = null ) : string Saves image data to file.

Protected Methods

Method Description
__construct ( array $params, array $context = [] ) Constructor.
_logDebug ( string $message ) Logs a message at debug level.
_logErr ( string $message ) Logs a message at error level.

Method Details

__call() public method

Catch-all method so that we don't error out when calling an unsupported manipulation method.
public __call ( $method, $args )

__construct() protected method

Constructor.
protected __construct ( array $params, array $context = [] )
$params array 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.
$context array The object context - configuration, injected objects: - logger: (Horde_Log_Logger) A logger. - tmpdir: [REQUIRED] (string) Temporary directory.

_logDebug() protected method

Logs a message at debug level.
protected _logDebug ( string $message )
$message string The log message.

_logErr() protected method

Logs a message at error level.
protected _logErr ( string $message )
$message string The log message.

addEffect() public method

Attempts to apply requested effect to this image.
public addEffect ( string $type, array $params )
$type string The type of effect to apply.
$params array Any parameters for the effect.

applyEffects() public method

Applies any effects in the effect queue.
public applyEffects ( )

brush() public method

Useful for scatter diagrams, debug points, etc. Draws squares, circles, diamonds, and triangles.
public brush ( integer $x, integer $y, string $color = 'black', string $shape = 'square' )
$x integer The x coordinate of the point to brush.
$y integer The y coordinate of the point to brush.
$color string The color to brush the point with.
$shape string What brush to use? Defaults to a square.

clearGeometry() public method

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

display() public method

Displays the current image.
public display ( )

getCapabilities() public method

Returns the capabilities.
public getCapabilities ( ) : array
return array A list of backend capabilities.

getContentType() public method

Returns the MIME type for this image.
public getContentType ( ) : string
return string The MIME type for this image.

getDimensions() public method

Returns the height and width of the current image data.
public getDimensions ( ) : array
return array An hash with 'width' containing the width, 'height' containing the height of the image.

getImageAtIndex() public method

Returns a specific image from the pages of images.
public getImageAtIndex ( integer $index ) : Horde_Image_Base
$index integer The index to return.
return Horde_Image_Base The requested image

getImagePageCount() public method

Returns the number of image pages available in the image object.
public getImagePageCount ( ) : integer
return integer The number of images.

getLoadedEffects() public method

Returns a list of available effects for this driver.
public getLoadedEffects ( )

getTmpDir() public method

Returns the current temporary directory.
public getTmpDir ( ) : string
return string The current temporary directory.

getType() public method

Returns the image type.
public getType ( ) : string
return string The type of this image (png, jpg, etc.).

hasCapability() public method

Checks the existence of a particular capability.
public hasCapability ( string $capability ) : boolean
$capability string The capability to check for.
return boolean True if the backend has this capability.

headers() public method

Sends HTTP headers for the image.
public headers ( )

loadFile() public method

Loads the image data from a file.
public loadFile ( string $filename )
$filename string The full path and filename to the file to load the image data from.

loadString() public method

Loads the image data from a string.
public loadString ( string $image_data )
$image_data string The data to use for the image.

raw() public method

Returns the raw data for this image.
public raw ( boolean $convert = false ) : string
$convert boolean If true, the image data will be returned in the target format, independently from any image operations.
return string The raw image data.

reset() public method

Resets the image data to defaults.
public reset ( )

setType() public method

Sets the output image type.
public setType ( string $type ) : string
$type string An image type (png, jpg, etc.)
return string The previous image type.

toFile() public method

If $data is false, saves current image data after performing any pending operations on the data. If $data contains raw image data, saves that data to file without regard for the current image data.
public toFile ( $data = null ) : string
return string Path to temporary file.

Property Details

$_background protected_oe property

Background color.
protected string $_background
return string

$_capabilities protected_oe property

Capabilites of this driver.
protected array $_capabilities
return array

$_context protected_oe property

Cache the context
protected $_context

$_data protected_oe property

The current image data.
protected string $_data
return string

$_height protected_oe property

The current height of the image data.
protected int $_height
return integer

$_loadedEffects protected_oe property

Array containing available Effects
protected array $_loadedEffects
return array

$_logger protected_oe property

Logger.
protected $_logger

$_tmpdir protected_oe property

A directory for temporary files.
protected string $_tmpdir
return string

$_type protected_oe property

What kind of images should ImageMagick generate? Defaults to 'png'.
protected string $_type
return string

$_width protected_oe property

The current width of the image data.
protected int $_width
return integer