Documentation

Horde_Image_Png extends Horde_Image_Base
in package

This class implements the Horde_Image API for PNG images.

It mainly provides some utility functions, such as the ability to make pixels or solid images for now.

Tags
author

Mike Cochrane mike@graftonhall.co.nz

category

Horde

copyright

2003-2017 Horde LLC

license

http://www.horde.org/licenses/lgpl21 LGPL-2.1

Table of Contents

$_background  : string
Background color.
$_capabilities  : array<string|int, mixed>
Capabilites of this driver.
$_colorDepth  : int
Color depth (only 8 and 16 implemented).
$_colorType  : int
Color type (only 2 (true color) implemented).
$_compressionMethod  : int
Compression method (0 is the only current valid value).
$_context  : mixed
Cache the context
$_data  : Horde_Stream
The current image data.
$_filterMethod  : int
Filter method (0 is the only current valid value).
$_height  : int
The current height of the image data.
$_img  : array<string|int, mixed>
The array of pixel data.
$_interlaceMethod  : int
Interlace method (only 0 (no interlace) implemented).
$_loadedEffects  : array<string|int, mixed>
Array containing available Effects
$_logger  : mixed
Logger.
$_tmpdir  : string
A directory for temporary files.
$_type  : string
What kind of images should ImageMagick generate? Defaults to 'png'.
$_width  : int
The current width of the image data.
__call()  : mixed
Catch-all method so that we don't error out when calling an unsupported manipulation method.
__construct()  : mixed
PNG image constructor.
addEffect()  : mixed
Attempts to apply requested effect to this image.
applyEffects()  : mixed
Applies any effects in the effect queue.
brush()  : mixed
Draws a shaped point at the specified (x,y) point.
clearGeometry()  : mixed
Utility function to zero out cached geometry information.
display()  : mixed
Displays the current image.
getCapabilities()  : array<string|int, mixed>
Returns the capabilities.
getContentType()  : string
Returns the MIME type for this image.
getDimensions()  : array<string|int, mixed>
Returns the height and width of the current image data.
getImageAtIndex()  : Horde_Image_Png
Requests a specific image from the collection of images.
getImagePageCount()  : int
Returns the number of image pages available in the image object.
getLoadedEffects()  : mixed
Returns a list of available effects for this driver.
getTmpDir()  : string
Returns the current temporary directory.
getType()  : string
Returns the image type.
hasCapability()  : bool
Checks the existence of a particular capability.
headers()  : mixed
Sends HTTP headers for the image.
loadFile()  : mixed
Loads the image data from a file.
loadString()  : mixed
Loads the image data from a string.
raw()  : string
Returns the raw data for this image.
rectangle()  : mixed
Draws a rectangle.
reset()  : mixed
Resets the image data to defaults.
setType()  : string
Sets the output image type.
toFile()  : string
Saves image data to file.
_Adler32()  : mixed
Calculates an Adler32 checksum for a string.
_header()  : mixed
Creates the PNG file header.
_IDAT()  : mixed
Creates the IDAT block.
_IEND()  : mixed
Creates the IEND block.
_IHDR()  : mixed
Creates the IHDR block.
_logDebug()  : mixed
Logs a message at debug level.
_logErr()  : mixed
Logs a message at error level.
_tEXt()  : mixed
Creates the tEXt block.
_tIME()  : mixed
Creates the tIME block.

Properties

$_background

Background color.

protected string $_background = 'white'

$_capabilities

Capabilites of this driver.

protected array<string|int, mixed> $_capabilities = array()

$_colorDepth

Color depth (only 8 and 16 implemented).

protected int $_colorDepth = 8

$_colorType

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

protected int $_colorType = 2

$_compressionMethod

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

protected int $_compressionMethod = 0

$_context

Cache the context

protected mixed $_context

$_data

The current image data.

protected Horde_Stream $_data

$_filterMethod

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

protected int $_filterMethod = 0

$_height

The current height of the image data.

protected int $_height = 0

$_img

The array of pixel data.

protected array<string|int, mixed> $_img = array()

$_interlaceMethod

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

protected int $_interlaceMethod = 0

$_loadedEffects

Array containing available Effects

protected array<string|int, mixed> $_loadedEffects = array()

$_logger

Logger.

protected mixed $_logger

$_tmpdir

A directory for temporary files.

protected string $_tmpdir

$_type

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

protected string $_type = 'png'

$_width

The current width of the image data.

protected int $_width = 0

Methods

__call()

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

public __call(mixed $method, mixed $args) : mixed
Parameters
$method : mixed
$args : mixed
Return values
mixed

__construct()

PNG image constructor.

public __construct(mixed $params[, mixed $context = array() ]) : mixed
Parameters
$params : mixed

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 : mixed = array()

The object context - configuration, injected objects:

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

addEffect()

Attempts to apply requested effect to this image.

public addEffect(string $type, array<string|int, mixed> $params) : mixed
Parameters
$type : string

The type of effect to apply.

$params : array<string|int, mixed>

Any parameters for the effect.

Return values
mixed

applyEffects()

Applies any effects in the effect queue.

public applyEffects() : mixed
Return values
mixed

brush()

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

public brush(int $x, int $y[, string $color = 'black' ][, string $shape = 'square' ]) : mixed

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

Parameters
$x : int

The x coordinate of the point to brush.

$y : int

The y coordinate of the point to brush.

$color : string = 'black'

The color to brush the point with.

$shape : string = 'square'

What brush to use? Defaults to a square.

Return values
mixed

clearGeometry()

Utility function to zero out cached geometry information.

public clearGeometry() : mixed

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

Return values
mixed

display()

Displays the current image.

public display() : mixed
Return values
mixed

getCapabilities()

Returns the capabilities.

public getCapabilities() : array<string|int, mixed>
Return values
array<string|int, mixed>

A list of backend capabilities.

getContentType()

Returns the MIME type for this image.

public getContentType() : string
Return values
string

The MIME type for this image.

getDimensions()

Returns the height and width of the current image data.

public getDimensions() : array<string|int, mixed>
Return values
array<string|int, mixed>

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

getImagePageCount()

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

public getImagePageCount() : int
Return values
int

The number of images.

getLoadedEffects()

Returns a list of available effects for this driver.

public getLoadedEffects() : mixed
Return values
mixed

getTmpDir()

Returns the current temporary directory.

public getTmpDir() : string
Return values
string

The current temporary directory.

getType()

Returns the image type.

public getType() : string
Return values
string

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

hasCapability()

Checks the existence of a particular capability.

public hasCapability(string $capability) : bool
Parameters
$capability : string

The capability to check for.

Return values
bool

True if the backend has this capability.

headers()

Sends HTTP headers for the image.

public headers() : mixed
Return values
mixed

loadFile()

Loads the image data from a file.

public loadFile(string $filename) : mixed
Parameters
$filename : string

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

Tags
throws
Horde_Image_Exception
Return values
mixed

loadString()

Loads the image data from a string.

public loadString(mixed $image_data) : mixed
Parameters
$image_data : mixed

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

Return values
mixed

raw()

Returns the raw data for this image.

public raw() : string
Return values
string

The raw image data.

rectangle()

Draws a rectangle.

public rectangle(int $x, int $y, int $width, int $height[, string $color = 'black' ][, string $fill = 'none' ]) : mixed
Parameters
$x : int

The left x-coordinate of the rectangle.

$y : int

The top y-coordinate of the rectangle.

$width : int

The width of the rectangle.

$height : int

The height of the rectangle.

$color : string = 'black'

The line color of the rectangle.

$fill : string = 'none'

The color to fill the rectangle.

Return values
mixed

reset()

Resets the image data to defaults.

public reset() : mixed
Return values
mixed

setType()

Sets the output image type.

public setType(string $type) : string
Parameters
$type : string

An image type (png, jpg, etc.)

Return values
string

The previous image type.

toFile()

Saves image data to file.

public toFile([mixed $data = null ]) : string

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 : mixed = null
Tags
throws
Horde_Image_Exception
Return values
string

Path to temporary file.

_Adler32()

Calculates an Adler32 checksum for a string.

protected _Adler32(mixed $input) : mixed
Parameters
$input : mixed
Return values
mixed

_header()

Creates the PNG file header.

protected _header() : mixed
Return values
mixed

_IDAT()

Creates the IDAT block.

protected _IDAT() : mixed
Return values
mixed

_IEND()

Creates the IEND block.

protected _IEND() : mixed
Return values
mixed

_IHDR()

Creates the IHDR block.

protected _IHDR() : mixed
Return values
mixed

_logDebug()

Logs a message at debug level.

protected _logDebug(string $message) : mixed
Parameters
$message : string

The log message.

Return values
mixed

_logErr()

Logs a message at error level.

protected _logErr(string $message) : mixed
Parameters
$message : string

The log message.

Return values
mixed

_tEXt()

Creates the tEXt block.

protected _tEXt(mixed $keyword, mixed $text) : mixed
Parameters
$keyword : mixed
$text : mixed
Return values
mixed

_tIME()

Creates the tIME block.

protected _tIME([int $date = null ]) : mixed
Parameters
$date : int = null

A timestamp.

Return values
mixed

Search results