system/libraries/Image.php
Class: Image_Core
class Image_Core
Manipulate images using standard methods such as resize, crop, rotate, etc. This class must be re-initialized for every image you wish to manipulate.
Methods
- Image_Core :: factory
- Image_Core -> __construct
- Image_Core -> __get
- Image_Core -> resize
- Image_Core -> crop
- Image_Core -> rotate
- Image_Core -> flip
- Image_Core -> quality
- Image_Core -> sharpen
- Image_Core -> save
- Image_Core -> render
- Image_Core -> valid_size
Image_Core :: factory
public static function factory
Creates a new Image instance and returns it.
Parameters:
- string image
- filename of image
- array config
- (NULL) non-default configurations
Return: object
Image_Core -> __construct
public function __construct
Creates a new image editor instance.
Parameters:
- string image
- filename of image
- array config
- (NULL) non-default configurations
Throws: Kohana_Exception
Return: void
Image_Core -> __get
public function __get
Handles retrieval of pre-save image properties
Parameters:
- string property
- property name
Return: mixed
Image_Core -> resize
public function resize
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.
Parameters:
- integer width
- width
- integer height
- height
- integer master
- (NULL) one of: Image::NONE, Image::AUTO, Image::WIDTH, Image::HEIGHT
Throws: Kohana_Exception
Return: object
Image_Core -> crop
public function crop
Crop an image to a specific width and height. You may also set the top and left offset. This method is chainable.
Parameters:
- integer width
- width
- integer height
- height
- integer top
- (string center) top offset, pixel value or one of: top, center, bottom
- integer left
- (string center) left offset, pixel value or one of: left, center, right
Throws: Kohana_Exception
Return: object
Image_Core -> rotate
public function rotate
Allows rotation of an image by 180 degrees clockwise or counter clockwise.
Parameters:
- integer degrees
- degrees
Return: object
Image_Core -> flip
public function flip
Flip an image horizontally or vertically.
Parameters:
- integer direction
- direction
Throws: Kohana_Exception
Return: object
Image_Core -> quality
public function quality
Change the quality of an image.
Parameters:
- integer amount
- quality as a percentage
Return: object
Image_Core -> sharpen
public function sharpen
Sharpen an image.
Parameters:
- integer amount
- amount to sharpen, usually ~20 is ideal
Return: object
Image_Core -> save
public function save
Save the image to a new image or overwrite this image.
Parameters:
- string new_image
- (FALSE) new image filename
- integer chmod
- (int 420) permissions for new image
Throws: Kohana_Exception
Return: object
Image_Core -> render
public function render
Output the image to the browser.
Return: object
Image_Core -> valid_size
protected function valid_size
Sanitize a given value type.
Parameters:
- string type
- type of property
- mixed value
- property value
Return: boolean