public
|
#
__construct( mixed $source = null )
Class constructor.
Parameters
- $source
mixed - $source Either a file path for a source image or a GD resource handler for an
image.
Throws
Since
11.3
|
public static
stdClass
|
#
getImageFileProperties( string $path )
Method to return a properties object for an image given a filesystem path.
The result object has values for image width, height, type, attributes, bits,
channels, mime type, file size and orientation.
Method to return a properties object for an image given a filesystem path.
The result object has values for image width, height, type, attributes, bits,
channels, mime type, file size and orientation.
Parameters
- $path
string - $path The filesystem path to the image for which to get properties.
Returns
Throws
Since
11.3
|
public
mixed
|
#
getOrientation( )
Method to detect whether an image's orientation is landscape, portrait or
square. The orientation will be returned as a string.
Method to detect whether an image's orientation is landscape, portrait or
square. The orientation will be returned as a string.
Returns
mixed - Orientation string or null.
Since
3.4.2
|
public
array
|
#
generateThumbs( mixed $thumbSizes, integer $creationMethod = JImage::SCALE_INSIDE )
Method to generate thumbnails from the current image. It allows creation by
resizing or cropping the original image.
Method to generate thumbnails from the current image. It allows creation by
resizing or cropping the original image.
Parameters
- $thumbSizes
mixed - $thumbSizes String or array of strings. Example: $thumbSizes =
array('150x75','250x150');
- $creationMethod
integer - $creationMethod 1-3 resize $scaleMethod | 4 create cropping | 5 resize then crop
Returns
array - returns the generated thumb in the results array
Throws
Since
12.2
|
public
array
|
#
createThumbs( mixed $thumbSizes, integer $creationMethod = JImage::SCALE_INSIDE , string $thumbsFolder = null )
Method to create thumbnails from the current image and save them to disk. It
allows creation by resizing or cropping the original image.
Method to create thumbnails from the current image and save them to disk. It
allows creation by resizing or cropping the original image.
Parameters
- $thumbSizes
mixed - $thumbSizes string or array of strings. Example: $thumbSizes =
array('150x75','250x150');
- $creationMethod
integer - $creationMethod 1-3 resize $scaleMethod | 4 create cropping
- $thumbsFolder
string - $thumbsFolder destination thumbs folder. null generates a thumbs folder in the
image folder
Returns
array - An array of JImage objects with thumb paths.
Throws
Since
12.2
|
public
JImage
|
#
crop( mixed $width, mixed $height, integer $left = null, integer $top = null, boolean $createNew = true )
Method to crop the current image.
Method to crop the current image.
Parameters
- $width
mixed - $width The width of the image section to crop in pixels or a percentage.
- $height
mixed - $height The height of the image section to crop in pixels or a percentage.
- $left
integer - $left The number of pixels from the left to start cropping.
- $top
integer - $top The number of pixels from the top to start cropping.
- $createNew
boolean - $createNew If true the current image will be cloned, cropped and returned; else
the current image will be cropped and returned.
Returns
Throws
Since
11.3
|
public
JImage
|
#
filter( string $type, array $options = array() )
Method to apply a filter to the image by type. Two examples are: grayscale
and sketchy.
Method to apply a filter to the image by type. Two examples are: grayscale
and sketchy.
Parameters
- $type
string - $type The name of the image filter to apply.
- $options
array - $options An array of options for the filter.
Returns
Throws
Since
11.3
See
|
public
integer
|
#
getHeight( )
Method to get the height of the image in pixels.
Method to get the height of the image in pixels.
Returns
integer
Throws
Since
11.3
|
public
integer
|
#
getWidth( )
Method to get the width of the image in pixels.
Method to get the width of the image in pixels.
Returns
integer
Throws
Since
11.3
|
public
string
|
#
getPath( )
Method to return the path
Method to return the path
Returns
string
Since
11.3
|
public
boolean
|
#
isLoaded( )
Method to determine whether or not an image has been loaded into the
object.
Method to determine whether or not an image has been loaded into the
object.
Returns
boolean
Since
11.3
|
public
boolean
|
#
isTransparent( )
Method to determine whether or not the image has transparency.
Method to determine whether or not the image has transparency.
Returns
boolean
Throws
Since
11.3
|
public
|
#
loadFile( string $path )
Method to load a file into the JImage object as the resource.
Method to load a file into the JImage object as the resource.
Parameters
- $path
string - $path The filesystem path to load as an image.
Throws
Since
11.3
|
public
JImage
|
#
resize( mixed $width, mixed $height, boolean $createNew = true, integer $scaleMethod = JImage::SCALE_INSIDE )
Method to resize the current image.
Method to resize the current image.
Parameters
- $width
mixed - $width The width of the resized image in pixels or a percentage.
- $height
mixed - $height The height of the resized image in pixels or a percentage.
- $createNew
boolean - $createNew If true the current image will be cloned, resized and returned; else
the current image will be resized and returned.
- $scaleMethod
integer - $scaleMethod Which method to use for scaling
Returns
Throws
Since
11.3
|
public
object
|
#
cropResize( integer $width, integer $height, boolean $createNew = true )
Method to crop an image after resizing it to maintain proportions without
having to do all the set up work.
Method to crop an image after resizing it to maintain proportions without
having to do all the set up work.
Parameters
- $width
integer - $width The desired width of the image in pixels or a percentage.
- $height
integer - $height The desired height of the image in pixels or a percentage.
- $createNew
boolean - $createNew If true the current image will be cloned, resized, cropped and
returned.
Returns
object - JImage Object for chaining.
Since
12.3
|
public
JImage
|
#
rotate( mixed $angle, integer $background = -1, boolean $createNew = true )
Method to rotate the current image.
Method to rotate the current image.
Parameters
- $angle
mixed - $angle The angle of rotation for the image
- $background
integer - $background The background color to use when areas are added due to rotation
- $createNew
boolean - $createNew If true the current image will be cloned, rotated and returned; else
the current image will be rotated and returned.
Returns
Throws
Since
11.3
|
public
JImage
|
#
flip( integer $mode, boolean $createNew = true )
Method to flip the current image.
Method to flip the current image.
Parameters
Returns
Throws
Since
11.3
|
public
boolean
|
#
toFile( string $path, integer $type = IMAGETYPE_JPEG, array $options = array() )
Method to write the current image out to a file.
Method to write the current image out to a file.
Parameters
- $path
string - $path The filesystem path to save the image.
- $type
integer - $type The image type to save the file as.
- $options
array - $options The image type options to use in saving the file.
Returns
boolean
Throws
Since
11.3
Link
|
protected
JImageFilter
|
#
getFilterInstance( string $type )
Method to get an image filter instance of a specified type.
Method to get an image filter instance of a specified type.
Parameters
- $type
string - $type The image filter type to get.
Returns
Throws
Since
11.3
|
protected
stdClass
|
#
prepareDimensions( integer $width, integer $height, integer $scaleMethod )
Method to get the new dimensions for a resized image.
Method to get the new dimensions for a resized image.
Parameters
- $width
integer - $width The width of the resized image in pixels.
- $height
integer - $height The height of the resized image in pixels.
- $scaleMethod
integer - $scaleMethod The method to use for scaling
Returns
Throws
Since
11.3
|
protected
integer
|
#
sanitizeHeight( mixed $height, mixed $width )
Method to sanitize a height value.
Method to sanitize a height value.
Parameters
- $height
mixed - $height The input height value to sanitize.
- $width
mixed - $width The input width value for reference.
Returns
integer
Since
11.3
|
protected
integer
|
#
sanitizeOffset( mixed $offset )
Method to sanitize an offset value like left or top.
Method to sanitize an offset value like left or top.
Parameters
- $offset
mixed - $offset An offset value.
Returns
integer
Since
11.3
|
protected
integer
|
#
sanitizeWidth( mixed $width, mixed $height )
Method to sanitize a width value.
Method to sanitize a width value.
Parameters
- $width
mixed - $width The input width value to sanitize.
- $height
mixed - $height The input height value for reference.
Returns
integer
Since
11.3
|
public
boolean
|
#
destroy( )
Method to destroy an image handle and free the memory associated with the
handle
Method to destroy an image handle and free the memory associated with the
handle
Returns
boolean - True on success, false on failure or if no image is loaded
Since
12.3
|
public
|
#
__destruct( )
Method to call the destroy() method one last time to free any memory when the
object is unset
Method to call the destroy() method one last time to free any memory when the
object is unset
Since
12.3
See
|
public
|
#
setThumbnailGenerate( boolean $quality = true )
Method for set option of generate thumbnail method
Method for set option of generate thumbnail method
Parameters
- $quality
boolean - $quality True for best quality. False for best speed.
Since
3.7.0
|