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

Class: WideImage

Source Location: /WideImage.php

Class Overview


The gateway class for loading images and core library functions


Variables

Constants

Methods



Class Details

[line 62]
The gateway class for loading images and core library functions



[ Top ]


Class Variables

static $path =  null

[line 77]



Tags:

var:  Path to the library base directory
access:  protected

Type:   string


[ Top ]



Class Methods


static method assertValidImageHandle [line 366]

static void assertValidImageHandle( mixed $handle)

Throws exception if the handle isn't a valid GD resource



Parameters:

mixed   $handle   The variable to check

[ Top ]

static method checkGD [line 102]

static void checkGD( )

Checks whether the gd library is loaded, and throws an exception otherwise



[ Top ]

static method createPaletteImage [line 333]

static WideImage_PaletteImage createPaletteImage( int $width, int $height)

Factory method for creating a palette image



Parameters:

int   $width  
int   $height  

[ Top ]

static method createTrueColorImage [line 345]

static WideImage_TrueColorImage createTrueColorImage( int $width, int $height)

Factory method for creating a true-color image



Parameters:

int   $width  
int   $height  

[ Top ]

static method isValidImageHandle [line 356]

static bool isValidImageHandle( mixed $handle)

Check whether the given handle is a valid GD resource



Parameters:

mixed   $handle   The variable to check

[ Top ]

static method load [line 150]

static WideImage_Image load( mixed $source)

Loads an image from a file, URL, HTML input file field, binary string, or a valid image handle.

The image format is auto-detected.

Currently supported formats: PNG, GIF, JPG, BMP, TGA, GD, GD2.

This function analyzes the input and decides whether to use WideImage::loadFromHandle(), WideImage::loadFromFile(), WideImage::loadFromUpload() or WideImage::loadFromString(), all of which you can also call directly to spare WideImage some guessing.

Arrays are supported for upload fields; it returns an array of loaded images. To load only a single image from an array field, use WideImage::loadFromUpload('img', $i), where $i is the index of the image you want to load.

  1.  $img WideImage::load('http://url/image.png')// image URL
  2.  $img WideImage::load('/path/to/image.png')// local file path
  3.  $img WideImage::load('img')// upload field name
  4.  $img WideImage::load(imagecreatetruecolor(1010))// a GD resource
  5.  $img WideImage::load($image_data)// binary string containing image data




Tags:

return:  WideImage_PaletteImage or WideImage_TrueColorImage instance


Parameters:

mixed   $source   File name, url, HTML file input field name, binary string, or a GD image resource

[ Top ]

static method loadFromFile [line 193]

static WideImage_Image loadFromFile( string $uri)

Create and load an image from a file or URL. The image format is auto-detected.



Tags:

return:  WideImage_PaletteImage or WideImage_TrueColorImage instance


Parameters:

string   $uri   File or url

[ Top ]

static method loadFromHandle [line 279]

static WideImage_Image loadFromHandle( resource $handle)

Create and load an image from an image handle.

Note: the resulting image object takes ownership of the passed handle. When the newly-created image object is destroyed, the handle is destroyed too, so it's not a valid image handle anymore. In order to preserve the handle for use after object destruction, you have to call WideImage_Image::releaseHandle() on the created image instance prior to its destruction.

  1.  $handle imagecreatefrompng('file.png');
  2.  $image WideImage::loadFromHandle($handle);




Tags:

return:  WideImage_PaletteImage or WideImage_TrueColorImage instance


Parameters:

resource   $handle   A valid GD image resource

[ Top ]

static method loadFromString [line 237]

static WideImage_Image loadFromString( string $string)

Create and load an image from a string. Format is auto-detected.



Tags:

return:  WideImage_PaletteImage or WideImage_TrueColorImage instance


Parameters:

string   $string   Binary data, i.e. from BLOB field in the database

[ Top ]

static method loadFromUpload [line 301]

static WideImage_Image loadFromUpload( $field_name $field_name, [int $index = null])

This method loads a file from the $_FILES array. The image format is auto-detected.

You only have to pass the field name as the parameter. For array fields, this function will return an array of image objects, unless you specify the $index parameter, which will load the desired image.




Tags:

return:  The loaded image


Parameters:

int   $index   The index of the file to load (if the input field is an array)
$field_name   $field_name   Name of the key in $_FILES array

[ Top ]

static method path [line 92]

static string path( )

Returns the path to the library



[ Top ]

static method registerCustomMapper [line 120]

static void registerCustomMapper( string $mapper_class_name, string $mime_type, string $extension)

Registers a custom mapper for image loading and saving

Example:

  1.      WideImage::registerCustomMapper('WideImage_Mapper_TGA''image/tga''tga');




Parameters:

string   $mapper_class_name  
string   $mime_type  
string   $extension  

[ Top ]

static method version [line 83]

static string version( )

Returns the library version



Tags:

return:  The library version


[ Top ]


Class Constants

SIDE_ALL =  255

[line 72]


[ Top ]

SIDE_BOTTOM =  32

[line 69]


[ Top ]

SIDE_BOTTOM_LEFT =  64

[line 70]


[ Top ]

SIDE_BOTTOM_RIGHT =  16

[line 68]


[ Top ]

SIDE_LEFT =  128

[line 71]


[ Top ]

SIDE_RIGHT =  8

[line 67]


[ Top ]

SIDE_TOP =  2

[line 65]


[ Top ]

SIDE_TOP_LEFT =  1

[line 64]


[ Top ]

SIDE_TOP_RIGHT =  4

[line 66]


[ Top ]



Documentation generated on Sat, 19 Feb 2011 12:55:43 +0100 by phpDocumentor 1.4.3