FreenetIS
 All Classes Namespaces Functions Variables Pages
Public Member Functions | Static Public Member Functions | Public Attributes | Static Public Attributes | Protected Member Functions | Protected Attributes | List of all members
Image Class Reference

Public Member Functions

 __construct ($image, $config=NULL)
 Creates a new image editor instance.
 __get ($property)
 Handles retrieval of pre-save image properties.
 resize ($width, $height, $master=NULL)
 Resize an image to a specific width and height.
 crop ($width, $height, $top= 'center', $left= 'center')
 Crop an image to a specific width and height.
 rotate ($degrees)
 Allows rotation of an image by 180 degrees clockwise or counter clockwise.
 flip ($direction)
 Flip an image horizontally or vertically.
 quality ($amount)
 Change the quality of an image.
 sharpen ($amount)
 Sharpen an image.
 save ($new_image=FALSE, $chmod=0644, $keep_actions=FALSE)
 Save the image to a new image or overwrite this image.
 render ($keep_actions=FALSE)
 Output the image to the browser.

Static Public Member Functions

static factory ($image, $config=NULL)
 Creates a new Image instance and returns it.

Public Attributes

const NONE = 1
const AUTO = 2
const HEIGHT = 3
const WIDTH = 4
const HORIZONTAL = 5
const VERTICAL = 6

Static Public Attributes

static $allowed_types

Protected Member Functions

 valid_size ($type, &$value)
 Sanitize a given value type.

Protected Attributes

 $driver
 $actions = array()
 $image = ''

Constructor & Destructor Documentation

Image::__construct (   $image,
  $config = NULL 
)

Creates a new image editor instance.

Exceptions
Kohana_Exception
Parameters
stringfilename of image
arraynon-default configurations
Returns
void

Member Function Documentation

Image::__get (   $property)

Handles retrieval of pre-save image properties.

Parameters
stringproperty name
Returns
mixed
Image::crop (   $width,
  $height,
  $top = 'center',
  $left = 'center' 
)

Crop an image to a specific width and height.

You may also set the top and left offset. This method is chainable.

Exceptions
Kohana_Exception
Parameters
integerwidth
integerheight
integertop offset, pixel value or one of: top, center, bottom
integerleft offset, pixel value or one of: left, center, right
Returns
object
static Image::factory (   $image,
  $config = NULL 
)
static

Creates a new Image instance and returns it.

Parameters
stringfilename of image
arraynon-default configurations
Returns
object
Image::flip (   $direction)

Flip an image horizontally or vertically.

Exceptions
Kohana_Exception
Parameters
integerdirection
Returns
object
Image::quality (   $amount)

Change the quality of an image.

Parameters
integerquality as a percentage
Returns
object
Image::render (   $keep_actions = FALSE)

Output the image to the browser.

Parameters
booleankeep or discard image process actions
Returns
object
Image::resize (   $width,
  $height,
  $master = NULL 
)

Resize an image to a specific width and height.

By default, Kohana will maintain the aspect ratio using the width as the master dimension. If you wish to use height as master dim, set $image->master_dim = Image::HEIGHT This method is chainable.

Exceptions
Kohana_Exception
Parameters
integerwidth
integerheight
integerone of: Image::NONE, Image::AUTO, Image::WIDTH, Image::HEIGHT
Returns
object
Image::rotate (   $degrees)

Allows rotation of an image by 180 degrees clockwise or counter clockwise.

Parameters
integerdegrees
Returns
object
Image::save (   $new_image = FALSE,
  $chmod = 0644,
  $keep_actions = FALSE 
)

Save the image to a new image or overwrite this image.

Exceptions
Kohana_Exception
Parameters
stringnew image filename
integerpermissions for new image
booleankeep or discard image process actions
Returns
object
Image::sharpen (   $amount)

Sharpen an image.

Parameters
integeramount to sharpen, usually ~20 is ideal
Returns
object
Image::valid_size (   $type,
$value 
)
protected

Sanitize a given value type.

Parameters
stringtype of property
mixedproperty value
Returns
boolean

Member Data Documentation

Image::$allowed_types
static
Initial value:
array
(
IMAGETYPE_GIF => 'gif',
IMAGETYPE_JPEG => 'jpg',
IMAGETYPE_PNG => 'png',
IMAGETYPE_TIFF_II => 'tiff',
IMAGETYPE_TIFF_MM => 'tiff',
)

The documentation for this class was generated from the following file: