Comments: on this page. Click to read or post your own.

Class GD

Description

A wrapper class for GD-based images, with lots of manipulation functions.

Located in /sapphire/filesystem/GD.php (line 7)

Object
   |
   --GD
Variable Summary
static mixed $default_quality
mixed $gd
mixed $height
mixed $quality
mixed $width
Method Summary
static void color_web2gd ( $image,  $webColor)
static void set_default_quality (quality $quality)
GD __construct ([ $filename = null])
GD crop (top $top, left $left, width $width, height $height)
void croppedResize ( $width,  $height)
void fittedResize ( $width,  $height)
integer getHeight ()
integer getWidth ()
void greyscale ([ $rv = 38], [ $gv = 36], [ $bv = 26])
void hasGD ()
void makeDir ( $dirname)
void paddedResize (width $width, height $height, [backgroundColour $backgroundColor = "FFFFFF"])
void resize ( $width,  $height)
void resizeByHeight ( $height)
void resizeByWidth ( $width)
void resizeRatio ( $maxWidth,  $maxHeight, [ $useAsMinimum = false])
GD rotate (angle $angle)
GD rotatePixelByPixel (angle $angle)
void setGD ( $gd)
void setQuality ( $quality)
void writeTo ( $filename)
Variables
static mixed $default_quality = 75 (line 11)
  • access: protected
mixed $gd (line 8)
  • access: protected
mixed $height (line 8)
  • access: protected
mixed $quality (line 9)
  • access: protected
mixed $width (line 8)
  • access: protected

Inherited Variables

Inherited from Object

Object::$builtInMethods
Object::$class
Object::$classConstructed
Object::$extensions
Object::$extension_instances
Object::$extraMethods
Object::$extraStatics
Object::$statics
Object::$static_cached
Methods
static method color_web2gd (line 276)
static void color_web2gd ( $image,  $webColor)
  • $image
  • $webColor
static method set_default_quality (line 42)

Set the default image quality.

static void set_default_quality (quality $quality)
  • quality $quality: int A number from 0 to 100, 100 being the best quality.
Constructor __construct (line 13)
GD __construct ([ $filename = null])
  • $filename

Redefinition of:
Object::__construct()
crop (line 217)

Crop's part of image.

GD crop (top $top, left $left, width $width, height $height)
  • top $top: y position of left upper corner of crop rectangle
  • left $left: x position of left upper corner of crop rectangle
  • width $width: rectangle width
  • height $height: rectangle height
croppedResize (line 58)

Resize an image to cover the given width/height completely, and crop off any overhanging edges.

void croppedResize ( $width,  $height)
  • $width
  • $height
fittedResize (line 105)

Resizes the image to fit within the given region.

Behaves similarly to paddedResize but without the padding.

  • todo: This method isn't very efficent
void fittedResize ( $width,  $height)
  • $width
  • $height
getHeight (line 241)

Method return height of image.

  • return: height
integer getHeight ()
getWidth (line 231)

Method return width of image.

  • return: width.
integer getWidth ()
greyscale (line 346)

Make the image greyscale

$rv = red value, defaults to 38 $gv = green value, defaults to 36 $bv = blue value, defaults to 26 Based (more or less entirely, with changes for readability) on code from http://www.teckis.com/scriptix/thumbnails/teck.html

void greyscale ([ $rv = 38], [ $gv = 36], [ $bv = 26])
  • $rv
  • $gv
  • $bv
hasGD (line 111)
void hasGD ()
makeDir (line 373)
void makeDir ( $dirname)
  • $dirname
paddedResize (line 293)

Resize to fit fully within the given box, without resizing. Extra space left around the image will be padded with the background color.

void paddedResize (width $width, height $height, [backgroundColour $backgroundColor = "FFFFFF"])
  • width $width
  • height $height
  • backgroundColour $backgroundColor
resize (line 119)

Resize an image, skewing it as necessary.

void resize ( $width,  $height)
  • $width
  • $height
resizeByHeight (line 256)

Resize an image by height. Preserves aspect ratio

void resizeByHeight ( $height)
  • $height
resizeByWidth (line 248)

Resize an image by width. Preserves aspect ratio.

void resizeByWidth ( $width)
  • $width
resizeRatio (line 265)

Resize the image by preserving aspect ratio. By default, it will keep the image inside the maxWidth and maxHeight

Passing useAsMinimum will make the smaller dimension equal to the maximum corresponding dimension

void resizeRatio ( $maxWidth,  $maxHeight, [ $useAsMinimum = false])
  • $maxWidth
  • $maxHeight
  • $useAsMinimum
rotate (line 150)

Rotates image by given angle.

GD rotate (angle $angle)
  • angle $angle
rotatePixelByPixel (line 173)

Rotates image by given angle. It's slow because makes it pixel by pixel rather than using built-in function. Used when imagerotate function is not available(i.e. Ubuntu)

GD rotatePixelByPixel (angle $angle)
  • angle $angle
setGD (line 32)
  • access: protected
void setGD ( $gd)
  • $gd
setQuality (line 51)

Set the image quality, used when saving JPEGs.

void setQuality ( $quality)
  • $quality
writeTo (line 378)
void writeTo ( $filename)
  • $filename

Inherited Methods

Inherited From Object

Object::__construct()
Object::addMethodsFrom()
Object::addStaticVars()
Object::addWrapperMethod()
Object::add_extension()
Object::allMethodNames()
Object::buildMethodList()
Object::cacheToFile()
Object::cacheToFileWithArgs()
Object::create()
Object::createMethod()
Object::defineMethods()
Object::exists()
Object::extend()
Object::extInstance()
Object::getCustomClass()
Object::hasExtension()
Object::hasMethod()
Object::invokeWithExtensions()
Object::is_a()
Object::loadCache()
Object::parentClass()
Object::sanitiseCachename()
Object::saveCache()
Object::set_stat()
Object::set_uninherited()
Object::stat()
Object::strong_create()
Object::uninherited()
Object::useCustomClass()
Object::__call()
Object::__toString()
blog comments powered by Disqus

Documentation generated on Sun, 19 Oct 2008 06:41:29 +1300 by phpDocumentor 1.3.2