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 |
|
Arguments
- $source
mixed
Either 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 |
|
Arguments
- $width
mixed
The width of the image section to crop in pixels or a percentage.- $height
mixed
The height of the image section to crop in pixels or a percentage.- $left
integer
The number of pixels from the left to start cropping.- $top
integer
The number of pixels from the top to start cropping.- $createNew
boolean
If true the current image will be cloned, cropped and returned; else the current image will be cropped and returned.
Response
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 |
|
Arguments
- $type
string
The name of the image filter to apply.- $options
array
An array of options for the filter.
Response
getFilterInstance
Method to get an image filter instance of a specified type.
getFilterInstance(string $type) : \JImageFilter
since |
11.3 |
---|---|
throws |
|
Arguments
- $type
string
The image filter type to get.
Response
getHeight
Method to get the height of the image in pixels.
getHeight() : integer
since |
11.3 |
---|---|
throws |
|
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
since |
11.3 |
---|---|
throws |
|
Arguments
- $path
string
The 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 |
|
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 |
|
Response
boolean
loadFile
Method to load a file into the JImage object as the resource.
loadFile(string $path) : void
since |
11.3 |
---|---|
throws |
|
Arguments
- $path
string
The 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 |
|
Arguments
- $width
integer
The width of the resized image in pixels.- $height
integer
The height of the resized image in pixels.- $scaleMethod
integer
The 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 |
|
Arguments
- $width
mixed
The width of the resized image in pixels or a percentage.- $height
mixed
The height of the resized image in pixels or a percentage.- $createNew
boolean
If true the current image will be cloned, resized and returned; else the current image will be resized and returned.- $scaleMethod
integer
Which method to use for scaling
Response
rotate
Method to rotate the current image.
rotate(mixed $angle, integer $background = -1, boolean $createNew = true) : \JImage
since |
11.3 |
---|---|
throws |
|
Arguments
- $angle
mixed
The angle of rotation for the image- $background
integer
The background color to use when areas are added due to rotation- $createNew
boolean
If true the current image will be cloned, rotated and returned; else the current image will be rotated and returned.
Response
sanitizeHeight
Method to sanitize a height value.
sanitizeHeight(mixed $height, mixed $width) : integer
since |
11.3 |
---|
Arguments
- $height
mixed
The input height value to sanitize.- $width
mixed
The 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
mixed
An offset value.
Response
integer
sanitizeWidth
Method to sanitize a width value.
sanitizeWidth(mixed $width, mixed $height) : integer
since |
11.3 |
---|
Arguments
- $width
mixed
The input width value to sanitize.- $height
mixed
The 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 | |
---|---|
since |
11.3 |
throws |
|
Arguments
- $path
string
The filesystem path to save the image.- $type
integer
The image type to save the file as.- $options
array
The 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.
since |
11.3 |
---|
Type(s)
array