Methods

__construct()

__construct($config) 

Parameters

$config

Initialize by loading config

_init() : void

Adds a border to the image.

border(integer $size, string $color) : \Fuel\Core\Image_Driver

Parameters

$size

integer

The side of the border, in pixels.

$color

string

A hexadecimal color.

Returns

Accepts configuration in either an array (as $index) or a pairing using $index and $value

config(string $index, mixed $value) : \Fuel\Core\Image_Driver

Parameters

$index

string

The index to be set, or an array of configuration options.

$value

mixed

The value to be set if $index is not an array.

Returns

Crops the image using coordinates or percentages.

crop(integer $x1, integer $y1, integer $x2, integer $y2) : \Fuel\Core\Image_Driver

Positive whole numbers or percentages are coordinates from the top left.

Negative whole numbers or percentages are coordinates from the bottom right.

Parameters

$x1

integer

X-Coordinate for first set.

$y1

integer

Y-Coordinate for first set.

$x2

integer

X-Coordinate for second set.

$y2

integer

Y-Coordinate for second set.

Returns

crop_resize()

crop_resize($width, $height) 

Parameters

$width

$height

Get the file extension (type) worked out on construct

extension() : string

Returns

stringFile extension

Creates a vertical / horizontal or both mirror image.

flip(mixed $direction) : \Fuel\Core\Image_Driver

Parameters

$direction

mixed

'vertical', 'horizontal', 'both'

Returns

Turns the image into a grayscale version

grayscale() : \Fuel\Core\Image_Driver

Loads the image and checks if its compatible.

load(string $filename, string $return_data, mixed $force_extension) : \Fuel\Core\Image_Driver

Parameters

$filename

string

The file to load

$return_data

string

Decides if it should return the images data, or just "$this".

$force_extension

mixed

Decides if it should force the extension with this (or false)

Returns

Masks the image using the alpha channel of the image input.

mask(string $maskimage) : \Fuel\Core\Image_Driver

Parameters

$maskimage

string

The location of the image to use as the mask

Returns

Outputs the file directly to the user.

output(string $filetype) : array

Parameters

$filetype

string

The extension type to use. Ex: png, jpg, gif

Exceptions

\FuelException

Returns

array

Executes the presets set in the config.

preset(string $name) : \Fuel\Core\Image_Driver

Additional parameters replace the $1, $2, ect.

Parameters

$name

string

The name of the preset.

Returns

Reloads the image.

reload() : \Fuel\Core\Image_Driver

Resize the image.

resize(integer $width, integer $height, boolean $keepar, boolean $pad) : \Fuel\Core\Image_Driver

If the width or height is null, it will resize retaining the original aspect ratio.

Parameters

$width

integer

The new width of the image.

$height

integer

The new height of the image.

$keepar

boolean

If false, allows stretching of the image.

$pad

boolean

Adds padding to the image when resizing.

Returns

Rotates the image

rotate(integer $degrees) : \Fuel\Core\Image_Driver

Parameters

$degrees

integer

The degrees to rotate, negatives integers allowed.

Returns

Adds rounded corners to the image.

rounded(integer $radius, integer $sides, integer $antialias) : \Fuel\Core\Image_Driver

Parameters

$radius

integer

$sides

integer

Accepts any combination of "tl tr bl br" separated by spaces, or null for all sides

$antialias

integer

Sets the anti-alias range.

Returns

Runs all queued actions on the loaded image.

run_queue(boolean $clear) 

Parameters

$clear

boolean

Decides if the queue should be cleared once completed.

Saves the image, and optionally attempts to set permissions

save(string $filename, string $permissions) : array

Parameters

$filename

string

The location where to save the image.

$permissions

string

Allows unix style permissions

Returns

array

Saves the file in the original location, adding the append and prepend to the filename.

save_pa(string $append, string $prepend, string $extension, integer $permissions) : \Fuel\Core\Image_Driver

Parameters

$append

string

The string to append to the filename

$prepend

string

The string to prepend to the filename

$extension

string

The extension to save the image as, null defaults to the loaded images extension.

$permissions

integer

The permissions to attempt to set on the file.

Returns

Returns sizes for the currently loaded image, or the image given in the $filename.

sizes(string $filename) : object

Parameters

$filename

string

The location of the file to get sizes for.

Returns

objectAn object containing width and height variables.

Adds a watermark to the image.

watermark(string $filename, string $position, integer $padding) : \Fuel\Core\Image_Driver

Parameters

$filename

string

The filename of the watermark file to use.

$position

string

The position of the watermark, ex: "bottom right", "center center", "top left"

$padding

integer

The amount of padding (in pixels) from the position.

Returns

 Properties