Image

Package Image
Inheritance class Image
Manipulate images using standard methods such as resize, crop, rotate, etc. This class must be re-initialized for every image you wish to manipulate.

$Id: Image.php 3809 2008-12-18 12:48:41Z OscarB $

Public Properties

Hide inherited properties

PropertyTypeDescriptionDefined By
allowed_types Image

Protected Properties

Hide inherited properties

PropertyTypeDescriptionDefined By
actions Image
driver Image
image Image

Public Methods

Hide inherited methods

MethodDescriptionDefined By
__construct() Creates a new image editor instance. Image
__get() Handles retrieval of pre-save image properties Image
crop() Crop an image to a specific width and height. You may also set the top Image
factory() Creates a new Image instance and returns it. Image
flip() Flip an image horizontally or vertically. Image
quality() Change the quality of an image. Image
render() Output the image to the browser. Image
resize() Resize an image to a specific width and height. By default, Kohana will Image
rotate() Allows rotation of an image by 180 degrees clockwise or counter clockwise. Image
save() Save the image to a new image or overwrite this image. Image
sharpen() Sharpen an image. Image

Protected Methods

Hide inherited methods

MethodDescriptionDefined By
valid_size() Sanitize a given value type. Image

Property Details

actions property
protected $actions;

allowed_types property
public static $allowed_types;

driver property
protected $driver;

image property
protected $image;

Method Details

__construct() method
public void __construct(string $image, array $config=NULL)
$image string filename of image
$config array non-default configurations
{return} void

Creates a new image editor instance.

__get() method
public mixed __get(string $property)
$property string property name
{return} mixed

Handles retrieval of pre-save image properties

crop() method
public object crop(integer $width, integer $height, integer $top='center', integer $left='center')
$width integer width
$height integer height
$top integer top offset, pixel value or one of: top, center, bottom
$left integer left offset, pixel value or one of: left, center, right
{return} object

Crop an image to a specific width and height. You may also set the top and left offset. This method is chainable.

factory() method
public static object factory(string $image, array $config=NULL)
$image string filename of image
$config array non-default configurations
{return} object

Creates a new Image instance and returns it.

flip() method
public object flip(integer $direction)
$direction integer direction
{return} object

Flip an image horizontally or vertically.

quality() method
public object quality(integer $amount)
$amount integer quality as a percentage
{return} object

Change the quality of an image.

render() method
public object render(boolean $keep_actions=false)
$keep_actions boolean keep or discard image process actions
{return} object

Output the image to the browser.

resize() method
public object resize(integer $width, integer $height, integer $master=NULL)
$width integer width
$height integer height
$master integer one of: Image::NONE, Image::AUTO, Image::WIDTH, Image::HEIGHT
{return} object

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.

rotate() method
public object rotate(integer $degrees)
$degrees integer degrees
{return} object

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

save() method
public object save(string $new_image=false, integer $chmod=420, boolean $keep_actions=false)
$new_image string new image filename
$chmod integer permissions for new image
$keep_actions boolean keep or discard image process actions
{return} object

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

sharpen() method
public object sharpen(integer $amount)
$amount integer amount to sharpen, usually ~20 is ideal
{return} object

Sharpen an image.

valid_size() method
protected boolean valid_size(string $type, mixed $value)
$type string type of property
$value mixed property value
{return} boolean

Sanitize a given value type.