[ class tree: core ] [ index: core ] [ all elements ]

Procedural File: lib-GD.php

Source Location: /lib-GD.php

Page Details

library for image handling using the GD library of functions

Classes
Class Description
lib_GD_Options Option class for lib-GD
Functions
imageBlurGD  [line 556]

provides image blur support for lib-GD:zp_imageUnsharpMask

Parameters:
image   $imgCanvas: 
int   $radius: 
int   $w: 
int   $h: 
   $imgCanvas2: 


void imageBlurGD( image $imgCanvas, $imgCanvas2, int $radius, int $w, int $h  )

[ Top ]
zp_colorAllocate  [line 436]

Returns an RGB color identifier

Parameters:
resource   $image: 
int   $red: 
int   $green: 
int   $blue: 


int zp_colorAllocate( resource $image, int $red, int $green, int $blue  )

[ Top ]
zp_copyCanvas  [line 153]

copies an image canvas

Parameters:
image   $imgCanvas:  source canvas
image   $img:  destination canvas
int   $dest_x:  destination x
int   $dest_y:  destination y
int   $src_x:  source x
int   $src_y:  source y
int   $w:  width
int   $h:  height


void zp_copyCanvas( image $imgCanvas, image $img, int $dest_x, int $dest_y, int $src_x, int $src_y, int $w, int $h  )

[ Top ]
zp_createImage  [line 113]

Creates a true color image

Parameters:
int   $w:  the width of the image
int   $h:  the height of the image


image zp_createImage( int $w, int $h  )

[ Top ]
zp_drawRectangle  [line 466]

Creates a rectangle

Parameters:
resource   $image: 
int   $x1: 
int   $y1: 
int   $x2: 
int   $y2: 
int   $color: 


bool zp_drawRectangle( resource $image, int $x1, int $y1, int $x2, int $y2, int $color  )

[ Top ]
zp_getFonts  [line 485]

Returns a list of available fonts


array zp_getFonts( )

[ Top ]
zp_graphicsLibInfo  [line 475]

Returns array of graphics library info


array zp_graphicsLibInfo( )

[ Top ]
zp_imageCanRotate  [line 312]

Returns true if GD library is configued with image rotation suppord


bool zp_imageCanRotate( )

[ Top ]
zp_imageColorTransparent  [line 137]

Sets the transparency color

Parameters:
image   $image: 
color   $color: 


bool zp_imageColorTransparent( image $image, color $color  )

[ Top ]
zp_imageDims  [line 336]

Returns the image height and width

Parameters:
string   $filename: 


array zp_imageDims( string $filename  )

[ Top ]
zp_imageFill  [line 126]

Fills an image area

Parameters:
image   $image: 
int   $x: 
int   $y: 
color   $color: 


bool zp_imageFill( image $image, int $x, int $y, color $color  )

[ Top ]
zp_imageFontHeight  [line 544]

Returns the font height in pixels

Parameters:
int   $font: 


int zp_imageFontHeight( int $font  )

[ Top ]
zp_imageFontWidth  [line 534]

Returns the font width in pixels

Parameters:
int   $font: 


int zp_imageFontWidth( int $font  )

[ Top ]
zp_imageFromString  [line 580]

creates an image from an image stream

Parameters:
$string   $string: 


void zp_imageFromString( $string $string  )

[ Top ]
zp_imageGet  [line 62]

Takes an image filename and returns a GD Image using the correct function for the image's format (imagecreatefrom*). Supports JPEG, GIF, and PNG.

Parameters:
string   $imagefile:  the full path and filename of the image to load.
   $imgfile: 

API Tags:
Return:  the loaded GD image object.


image zp_imageGet( $imgfile, string $imagefile  )

[ Top ]
zp_imageGray  [line 406]

Creates a grayscale image

Parameters:
resource   $image: 


resource zp_imageGray( resource $image  )

[ Top ]
zp_imageHeight  [line 378]

Returns the height of an image resource

Parameters:
resource   $im: 


int zp_imageHeight( resource $im  )

[ Top ]
zp_imageIPTC  [line 352]

Returns the IPTC data of an image

Parameters:
string   $filename: 


string zp_imageIPTC( string $filename  )

[ Top ]
zp_imageKill  [line 423]

destroys an image resource

Parameters:
resource   $im: 


bool zp_imageKill( resource $im  )

[ Top ]
zp_imageLoadFont  [line 516]

Loads a font and returns its font id

Parameters:
string   $font: 


int zp_imageLoadFont( [string $font = NULL]  )

[ Top ]
zp_imageMerge  [line 396]

Does a copy merge of two image resources

Parameters:
resource   $dst_im: 
resource   $src_im: 
int   $dst_x: 
int   $dst_y: 
int   $src_x: 
int   $src_y: 
int   $src_w: 
int   $src_h: 
int   $pct: 


bool zp_imageMerge( resource $dst_im, resource $src_im, int $dst_x, int $dst_y, int $src_x, int $src_y, int $src_w, int $src_h, int $pct  )

[ Top ]
zp_imageOutput  [line 86]

outputs an image resource as a given type

Parameters:
resource   $im: 
string   $type: 
string   $filename: 
int   $qual: 


void zp_imageOutput( resource $im, string $type, [string $filename = NULL], [int $qual = 75]  )

[ Top ]
zp_imageResizeAlpha  [line 290]

Resize a PNG file with transparency to given dimensions and still retain the alpha channel information Author: Alex Le - http://www.alexle.net

Parameters:
image   $src: 
int   $w: 
int   $h: 
   &$src: 


image zp_imageResizeAlpha( &$src, int $w, int $h, image $src  )

[ Top ]
zp_imageUnsharpMask  [line 215]

Sharpens an image using an Unsharp Mask filter.

Original description from the author:

WARNING ! Due to a known bug in PHP 4.3.2 this script is not working well in this version. The sharpened images get too dark. The bug is fixed in version 4.3.3.

From version 2 (July 17 2006) the script uses the imageconvolution function in PHP version >= 5.1, which improves the performance considerably.

Unsharp masking is a traditional darkroom technique that has proven very suitable for digital imaging. The principle of unsharp masking is to create a blurred copy of the image and compare it to the underlying original. The difference in colour values between the two images is greatest for the pixels near sharp edges. When this difference is subtracted from the original image, the edges will be accentuated.

The Amount parameter simply says how much of the effect you want. 100 is 'normal'. Radius is the radius of the blurring circle of the mask. 'Threshold' is the least difference in colour values that is allowed between the original and the mask. In practice this means that low-contrast areas of the picture are left unrendered whereas edges are treated normally. This is good for pictures of e.g. skin or blue skies.

Any suggenstions for improvement of the algorithm, expecially regarding the speed and the roundoff errors in the Gaussian blur process, are welcome.

Permission to license this code under the GPL was granted by the author on 2/12/2007.

Parameters:
image   $img:  the GD format image to sharpen. This is not a URL string, but should be the result of a GD image function.
int   $amount:  the strength of the sharpening effect. Nominal values are between 0 and 100.
int   $radius:  the pixel radius of the sharpening mask. A smaller radius sharpens smaller details, and a larger radius sharpens larger details.
int   $threshold:  the color difference threshold required for sharpening. A low threshold sharpens all edges including faint ones, while a higher threshold only sharpens more distinct edges.

API Tags:
Return:  the input image with the specified sharpening applied.


image zp_imageUnsharpMask( image $img, int $amount, int $radius, int $threshold  )

[ Top ]
zp_imageWidth  [line 368]

Returns the width of an image resource

Parameters:
resource   $im: 


int zp_imageWidth( resource $im  )

[ Top ]
zp_resampleImage  [line 172]

resamples an image to a new copy

Parameters:
resource   $dst_image: 
resource   $src_image: 
int   $dst_x: 
int   $dst_y: 
int   $src_x: 
int   $src_y: 
int   $dst_w: 
int   $dst_h: 
int   $src_w: 
int   $src_h: 


bool zp_resampleImage( resource $dst_image, resource $src_image, int $dst_x, int $dst_y, int $src_x, int $src_y, int $dst_w, int $dst_h, int $src_w, int $src_h  )

[ Top ]
zp_rotateImage  [line 324]

Rotates an image resource according to its EXIF info and auto_rotate option NB: requires the imagarotate function to be configured

Parameters:
resource   $im: 
int   $rotate: 


resource zp_rotateImage( resource $im, int $rotate  )

[ Top ]
zp_writeString  [line 451]

Rencers a string into the image

Parameters:
resource   $image: 
int   $font: 
int   $x: 
int   $y: 
string   $string: 
int   $color: 


bool zp_writeString( resource $image, int $font, int $x, int $y, string $string, int $color  )

[ Top ]


Documentation generated on Tue, 20 Dec 2011 16:07:35 +0100 by phpDocumentor 1.4.3