Class SimpleGdImage

Description

SimpleGdImage wraps arround GD image resource and provides methods to work with the resource as with a single object

  • version: 1.0

Located in /library/simplegd/classes/SimpleGdImage.class.php (line 10)


	
			
Class Constant Summary
Variable Summary
integer $height
integer $image_type
string $is_loaded
boolean $is_new
resouce $resource
string $source
integer $width
Method Summary
SimpleGdImage __construct ([string $load_from_file = null])
null __destruct (void 0)
null convertType (integer $to_type)
null createFromResource (resource $resource)
string getExtension (void 0)
integer getHeight (null 0)
integer getImageType (null 0)
string getMimeType (void 0)
string getSource (null 0)
integer getWidth (null 0)
boolean isLoaded (void 0)
boolean isNew (void 0)
null loadFromFile (string $file_path)
null reset (void 0)
boolean resize (integer $width, integer $height, [boolean $mutate = true])
boolean save (void 0)
null saveAs (string $file_path, [integer $as_type = null])
SimpleGdImage scale (integer $width, integer $height, [string $boundary = null], [boolean $mutate = true])
null setHeight (integer $value)
null setIsLoaded (void 0)
null setIsNew (void 0)
null setWidth (integer $value)
Variables
integer $height = null (line 64)

Image height, cached on request

  • access: protected
integer $image_type (line 50)

Image type

  • access: protected
string $is_loaded = false (line 29)

Is loaded flag, true if loaded this file from the file (or saved it to the file)

  • access: protected
boolean $is_new = true (line 22)

Is new flag, true if we created this image from resouce, not from file and we didn't save it to the file

  • access: protected
resouce $resource (line 36)

Image resouce

  • access: protected
string $source (line 43)

Original file path

  • access: protected
integer $width = null (line 57)

Image width, cached on request

  • access: protected
Methods
Constructor __construct (line 72)

Construct new SimpleGdImage object

SimpleGdImage __construct ([string $load_from_file = null])
  • string $load_from_file: Load content from image file
Destructor __destruct (line 82)

Destroy this object and free any memory associated with image image

null __destruct (void 0)
  • void 0
convertType (line 368)

Change internat type value

null convertType (integer $to_type)
  • integer $to_type
createFromResource (line 205)

User image resource to populate this object

null createFromResource (resource $resource)
  • resource $resource
getExtension (line 246)

Return extension based on the source file or type if we have new image

string getExtension (void 0)
  • void 0
getHeight (line 494)

Get height

integer getHeight (null 0)
  • null 0
getImageType (line 453)

Get image_type

integer getImageType (null 0)
  • null 0
getMimeType (line 236)

Return MIME type based on image type

string getMimeType (void 0)
  • void 0
getSource (line 433)

Get source

string getSource (null 0)
  • null 0
getWidth (line 473)

Get width

integer getWidth (null 0)
  • null 0
isLoaded (line 397)

Returns true if this image is loaded

boolean isLoaded (void 0)
  • void 0
isNew (line 387)

Returns true if this image is new (no file, just resource that we can manipulate)

boolean isNew (void 0)
  • void 0
loadFromFile (line 96)

Load this image from file

null loadFromFile (string $file_path)
  • string $file_path
reset (line 220)

Reset all fields

  • access: protected
null reset (void 0)
  • void 0
resize (line 269)

Resize image to given dimensions. This transformation will not keep the ratio of the image

boolean resize (integer $width, integer $height, [boolean $mutate = true])
  • integer $width: New width
  • integer $height
  • boolean $mutate: If true transofrmation will be done with the internal resource. If false new resouce will be created, new SimpleGdImage will be created from it and returned
save (line 142)

This function is used for saving files that are loaded to file in case you transformed the resource and want to save it back to the file. If this file is new or you want to change its type use saveAs() function

  • throws: ImageTypeNotSupportedError
  • throws: FileNotWriableError
boolean save (void 0)
  • void 0
saveAs (line 174)

Save image into the file

  • throws: ImageTypeNotSupportedError
  • throws: FailedToWriteFileError
null saveAs (string $file_path, [integer $as_type = null])
  • string $file_path
  • integer $as_type: Save image as type. Default type is PNG
scale (line 308)

Resize to $width x $height but keep the image proportion

SimpleGdImage scale (integer $width, integer $height, [string $boundary = null], [boolean $mutate = true])
  • integer $width: Max width
  • integer $height: Max height
  • string $boundary: Limit the scale action: drecrease or increase only. If $boundary is NULL than don't limit
  • boolean $mutate: Save the transformation in internal resource or create new image and keep internal as is?
setHeight (line 505)

Set height value

  • access: protected
null setHeight (integer $value)
  • integer $value
setIsLoaded (line 422)

Mark this object as loaded

null setIsLoaded (void 0)
  • void 0
setIsNew (line 411)

Mark this object as new

null setIsNew (void 0)
  • void 0
setWidth (line 484)

Set width value

  • access: protected
null setWidth (integer $value)
  • integer $value
Class Constants
BOUNDARY_DECREASE_ONLY = 'decrease' (line 14)
BOUNDARY_INCREASE_ONLY = 'increase' (line 13)

Boundaries *

Documentation generated on Wed, 23 Jan 2008 01:59:27 +0000 by phpDocumentor 1.4.0