JImage

Class to manipulate an image.

package

Joomla.Platform

subpackage

Image

since

11.3

Methods

__construct

Class constructor.

__construct(mixed $source = null) 
since

11.3

throws

\RuntimeException

Arguments

$source

mixedEither a file path for a source image or a GD resource handler for an image.

crop

Method to crop the current image.

crop(mixed $width, mixed $height, integer $left, integer $top, boolean $createNew = true) : \JImage
since

11.3

throws

\LogicException

Arguments

$width

mixedThe width of the image section to crop in pixels or a percentage.

$height

mixedThe height of the image section to crop in pixels or a percentage.

$left

integerThe number of pixels from the left to start cropping.

$top

integerThe number of pixels from the top to start cropping.

$createNew

booleanIf true the current image will be cloned, cropped and returned; else the current image will be cropped and returned.

Response

\JImage

filter

Method to apply a filter to the image by type. Two examples are: grayscale and sketchy.

filter(string $type, array $options = array()) : \JImage
since

11.3

see \JImageFilter
throws

\LogicException

\RuntimeException

Arguments

$type

stringThe name of the image filter to apply.

$options

arrayAn array of options for the filter.

Response

\JImage

getFilterInstance

Method to get an image filter instance of a specified type.

getFilterInstance(string $type) : \JImageFilter
since

11.3

throws

\RuntimeException

Arguments

$type

stringThe image filter type to get.

Response

\JImageFilter

getHeight

Method to get the height of the image in pixels.

getHeight() : integer
since

11.3

throws

\LogicException

Response

integer

getImageFileProperties

Method to return a properties object for an image given a filesystem path. The result object has values for image width, height, type, attributes, mime type, bits, and channels.

getImageFileProperties(string $path) : object
static
since

11.3

throws

\InvalidArgumentException

\RuntimeException

Arguments

$path

stringThe filesystem path to the image for which to get properties.

Response

object

getPath

Method to return the path

getPath() : string
since

11.3

Response

string

getWidth

Method to get the width of the image in pixels.

getWidth() : integer
since

11.3

throws

\LogicException

Response

integer

isLoaded

Method to determine whether or not an image has been loaded into the object.

isLoaded() : boolean
since

11.3

Response

boolean

isTransparent

Method to determine whether or not the image has transparency.

isTransparent() : boolean
since

11.3

throws

\LogicException

Response

boolean

loadFile

Method to load a file into the JImage object as the resource.

loadFile(string $path) : void
since

11.3

throws

\InvalidArgumentException

\RuntimeException

Arguments

$path

stringThe filesystem path to load as an image.

prepareDimensions

Method to get the new dimensions for a resized image.

prepareDimensions(integer $width, integer $height, integer $scaleMethod) : object
since

11.3

throws

\InvalidArgumentException

Arguments

$width

integerThe width of the resized image in pixels.

$height

integerThe height of the resized image in pixels.

$scaleMethod

integerThe method to use for scaling

Response

object

resize

Method to resize the current image.

resize(mixed $width, mixed $height, boolean $createNew = true, integer $scaleMethod = self::SCALE_INSIDE) : \JImage
since

11.3

throws

\LogicException

Arguments

$width

mixedThe width of the resized image in pixels or a percentage.

$height

mixedThe height of the resized image in pixels or a percentage.

$createNew

booleanIf true the current image will be cloned, resized and returned; else the current image will be resized and returned.

$scaleMethod

integerWhich method to use for scaling

Response

\JImage

rotate

Method to rotate the current image.

rotate(mixed $angle, integer $background = -1, boolean $createNew = true) : \JImage
since

11.3

throws

\LogicException

Arguments

$angle

mixedThe angle of rotation for the image

$background

integerThe background color to use when areas are added due to rotation

$createNew

booleanIf true the current image will be cloned, rotated and returned; else the current image will be rotated and returned.

Response

\JImage

sanitizeHeight

Method to sanitize a height value.

sanitizeHeight(mixed $height, mixed $width) : integer
since

11.3

Arguments

$height

mixedThe input height value to sanitize.

$width

mixedThe input width value for reference.

Response

integer

sanitizeOffset

Method to sanitize an offset value like left or top.

sanitizeOffset(mixed $offset) : integer
since

11.3

Arguments

$offset

mixedAn offset value.

Response

integer

sanitizeWidth

Method to sanitize a width value.

sanitizeWidth(mixed $width, mixed $height) : integer
since

11.3

Arguments

$width

mixedThe input width value to sanitize.

$height

mixedThe input height value for reference.

Response

integer

toFile

Method to write the current image out to a file.

toFile(string $path, integer $type = IMAGETYPE_JPEG, array $options = array()) : void
see

http://www.php.net/manual/image.constants.php

since

11.3

throws

\LogicException

Arguments

$path

stringThe filesystem path to save the image.

$type

integerThe image type to save the file as.

$options

arrayThe image type options to use in saving the file.

Constants

SCALE_FILL

Value 1
const

integer

since

11.3

Type(s)

SCALE_INSIDE

Value 2
const

integer

since

11.3

Type(s)

SCALE_OUTSIDE

Value 3
const

integer

since

11.3

Type(s)

Properties

handle

The image resource handle.

since

11.3

Type(s)

resource

path

The source image path.

since

11.3

Type(s)

string

formats

Whether or not different image formats are supported.

static
since

11.3

Type(s)

array