Image
Package | Image |
---|---|
Inheritance | class Image |
$Id: Image.php 3809 2008-12-18 12:48:41Z OscarB $
Public Methods
Method | Description | Defined 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
Method | Description | Defined By |
---|---|---|
valid_size() | Sanitize a given value type. | Image |
Property Details
Method Details
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.
public mixed __get(string $property)
| ||
$property | string | property name |
{return} | mixed |
Handles retrieval of pre-save image properties
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.
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.
public object flip(integer $direction)
| ||
$direction | integer | direction |
{return} | object |
Flip an image horizontally or vertically.
public object quality(integer $amount)
| ||
$amount | integer | quality as a percentage |
{return} | object |
Change the quality of an image.
public object render(boolean $keep_actions=false)
| ||
$keep_actions | boolean | keep or discard image process actions |
{return} | object |
Output the image to the browser.
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.
public object rotate(integer $degrees)
| ||
$degrees | integer | degrees |
{return} | object |
Allows rotation of an image by 180 degrees clockwise or counter clockwise.
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.
public object sharpen(integer $amount)
| ||
$amount | integer | amount to sharpen, usually ~20 is ideal |
{return} | object |
Sharpen an image.
protected boolean valid_size(string $type, mixed $value)
| ||
$type | string | type of property |
$value | mixed | property value |
{return} | boolean |
Sanitize a given value type.