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.
static
object
getImageFileProperties
(string $path)
-
string
$path: The filesystem path to the image for which to get properties.
Class constructor.
JImage
__construct
([mixed $source = null])
-
mixed
$source: Either a file path for a source image or a GD resource handler for an image.
Method to crop the current image.
JImage
crop
(
mixed $width,
mixed $height,
integer $left,
integer $top, [
bool $createNew =
true])
-
mixed
$width: The width of the image section to crop in pixels or a percentage.
-
mixed
$height: The height of the image section to crop in pixels or a percentage.
-
integer
$left: The number of pixels from the left to start cropping.
-
integer
$top: The number of pixels from the top to start cropping.
-
bool
$createNew: If true the current image will be cloned, cropped and returned; else the current image will be cropped and returned.
Method to apply a filter to the image by type. Two examples are: grayscale and sketchy.
JImage
filter
(
string $type, [
array $options =
array()])
-
string
$type: The name of the image filter to apply.
-
array
$options: An array of options for the filter.
Method to get an image filter instance of a specified type.
-
string
$type: The image filter type to get.
Method to get the height of the image in pixels.
integer
getHeight
()
Method to return the path
string
getPath
()
Method to get the width of the image in pixels.
integer
getWidth
()
Method to determine whether or not an image has been loaded into the object.
bool
isLoaded
()
Method to determine whether or not the image has transparency.
bool
isTransparent
()
Method to load a file into the JImage object as the resource.
void
loadFile
(string $path)
-
string
$path: The filesystem path to load as an image.
Method to get the new dimensions for a resized image.
object
prepareDimensions
(integer $width, integer $height, integer $scaleMethod)
-
integer
$width: The width of the resized image in pixels.
-
integer
$height: The height of the resized image in pixels.
-
integer
$scaleMethod: The method to use for scaling
Method to resize the current image.
JImage
resize
(
mixed $width,
mixed $height, [
bool $createNew =
true], [
integer $scaleMethod =
self::SCALE_INSIDE])
-
mixed
$width: The width of the resized image in pixels or a percentage.
-
mixed
$height: The height of the resized image in pixels or a percentage.
-
bool
$createNew: If true the current image will be cloned, resized and returned; else the current image will be resized and returned.
-
integer
$scaleMethod: Which method to use for scaling
Method to rotate the current image.
JImage
rotate
(
mixed $angle, [
integer $background =
-1], [
bool $createNew =
true])
-
mixed
$angle: The angle of rotation for the image
-
integer
$background: The background color to use when areas are added due to rotation
-
bool
$createNew: If true the current image will be cloned, rotated and returned; else the current image will be rotated and returned.
Method to sanitize a height value.
integer
sanitizeHeight
(mixed $height, mixed $width)
-
mixed
$height: The input height value to sanitize.
-
mixed
$width: The input width value for reference.
Method to sanitize an offset value like left or top.
integer
sanitizeOffset
(mixed $offset)
-
mixed
$offset: An offset value.
Method to sanitize a width value.
integer
sanitizeWidth
(mixed $width, mixed $height)
-
mixed
$width: The input width value to sanitize.
-
mixed
$height: The input height value for reference.
Method to write the current image out to a file.
void
toFile
(string $path, [integer $type = IMAGETYPE_JPEG], [array $options = array()])
-
string
$path: The filesystem path to save the image.
-
integer
$type: The image type to save the file as.
-
array
$options: The image type options to use in saving the file.