[ Index ]

PHP Cross Reference of Joomla 4.2.2 documentation

title

Body

[close]

/libraries/src/Image/ -> Image.php (summary)

Joomla! Content Management System

Copyright: (C) 2017 Open Source Matters, Inc.
License: GNU General Public License version 2 or later; see LICENSE
File Size: 1112 lines (36 kb)
Included or required:0 times
Referenced: 2 times
Includes or requires: 0 files

Defines 1 class

Image:: (29 methods):
  __construct()
  getHandle()
  getImageFileProperties()
  getOrientation()
  getOrientationString()
  generateThumbs()
  createThumbs()
  crop()
  filter()
  getHeight()
  getWidth()
  getPath()
  isLoaded()
  isTransparent()
  loadFile()
  resize()
  cropResize()
  rotate()
  flip()
  watermark()
  toFile()
  getFilterInstance()
  prepareDimensions()
  sanitizeHeight()
  sanitizeOffset()
  sanitizeWidth()
  destroy()
  __destruct()
  setThumbnailGenerate()


Class: Image  - X-Ref

Class to manipulate an image.

__construct($source = null)   X-Ref
Class constructor.

param: mixed  $source  Either a file path for a source image or a GD resource handler for an image.

getHandle()   X-Ref
Get the image resource handle

return: resource

getImageFileProperties($path)   X-Ref
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.

param: string  $path  The filesystem path to the image for which to get properties.
return: \stdClass

getOrientation()   X-Ref
Method to detect whether an image's orientation is landscape, portrait or square.

The orientation will be returned as a string.

return: mixed   Orientation string or null.

getOrientationString(int $width, int $height)   X-Ref
Compare width and height integers to determine image orientation.

param: integer  $width   The width value to use for calculation
param: integer  $height  The height value to use for calculation
return: string   Orientation string

generateThumbs($thumbSizes, $creationMethod = self::SCALE_INSIDE)   X-Ref
Method to generate thumbnails from the current image. It allows creation by resizing or cropping the original image.

param: mixed    $thumbSizes      String or array of strings. Example: $thumbSizes = array('150x75','250x150');
param: integer  $creationMethod  1-3 resize $scaleMethod | 4 create cropping | 5 resize then crop
return: array

createThumbs($thumbSizes, $creationMethod = self::SCALE_INSIDE, $thumbsFolder = null)   X-Ref
Method to create thumbnails from the current image and save them to disk. It allows creation by resizing or cropping the original image.

param: mixed    $thumbSizes      string or array of strings. Example: $thumbSizes = array('150x75','250x150');
param: integer  $creationMethod  1-3 resize $scaleMethod | 4 create cropping
param: string   $thumbsFolder    destination thumbs folder. null generates a thumbs folder in the image folder
return: array

crop($width, $height, $left = null, $top = null, $createNew = true)   X-Ref
Method to crop the current image.

param: mixed    $width      The width of the image section to crop in pixels or a percentage.
param: mixed    $height     The height of the image section to crop in pixels or a percentage.
param: integer  $left       The number of pixels from the left to start cropping.
param: integer  $top        The number of pixels from the top to start cropping.
param: boolean  $createNew  If true the current image will be cloned, cropped and returned; else
return: Image

filter($type, array $options = [])   X-Ref
Method to apply a filter to the image by type.  Two examples are: grayscale and sketchy.

param: string  $type     The name of the image filter to apply.
param: array   $options  An array of options for the filter.
return: Image

getHeight()   X-Ref
Method to get the height of the image in pixels.

return: integer

getWidth()   X-Ref
Method to get the width of the image in pixels.

return: integer

getPath()   X-Ref
Method to return the path

return: string

isLoaded()   X-Ref
Method to determine whether or not an image has been loaded into the object.

return: boolean

isTransparent()   X-Ref
Method to determine whether or not the image has transparency.

return: boolean

loadFile($path)   X-Ref
Method to load a file into the Image object as the resource.

param: string  $path  The filesystem path to load as an image.
return: void

resize($width, $height, $createNew = true, $scaleMethod = self::SCALE_INSIDE)   X-Ref
Method to resize the current image.

param: mixed    $width        The width of the resized image in pixels or a percentage.
param: mixed    $height       The height of the resized image in pixels or a percentage.
param: boolean  $createNew    If true the current image will be cloned, resized and returned; else
param: integer  $scaleMethod  Which method to use for scaling
return: Image

cropResize($width, $height, $createNew = true)   X-Ref
Method to crop an image after resizing it to maintain
proportions without having to do all the set up work.

param: integer  $width      The desired width of the image in pixels or a percentage.
param: integer  $height     The desired height of the image in pixels or a percentage.
param: boolean  $createNew  If true the current image will be cloned, resized, cropped and returned.
return: Image

rotate($angle, $background = -1, $createNew = true)   X-Ref
Method to rotate the current image.

param: mixed    $angle       The angle of rotation for the image
param: integer  $background  The background color to use when areas are added due to rotation
param: boolean  $createNew   If true the current image will be cloned, rotated and returned; else
return: Image

flip($mode, $createNew = true)   X-Ref
Method to flip the current image.

param: integer  $mode       The flip mode for flipping the image {@link http://php.net/imageflip#refsect1-function.imageflip-parameters}
param: boolean  $createNew  If true the current image will be cloned, flipped and returned; else
return: Image

watermark(Image $watermark, $transparency = 50, $bottomMargin = 0, $rightMargin = 0)   X-Ref
Watermark the image

param: Image    $watermark     The Image object containing the watermark graphic
param: integer  $transparency  The transparency to use for the watermark graphic
param: integer  $bottomMargin  The margin from the bottom of this image
param: integer  $rightMargin   The margin from the right side of this image
return: Image

toFile($path, $type = IMAGETYPE_JPEG, array $options = [])   X-Ref
Method to write the current image out to a file or output directly.

param: mixed    $path     The filesystem path to save the image.
param: integer  $type     The image type to save the file as.
param: array    $options  The image type options to use in saving the file.
return: boolean

getFilterInstance($type)   X-Ref
Method to get an image filter instance of a specified type.

param: string  $type  The image filter type to get.
return: ImageFilter

prepareDimensions($width, $height, $scaleMethod)   X-Ref
Method to get the new dimensions for a resized image.

param: integer  $width        The width of the resized image in pixels.
param: integer  $height       The height of the resized image in pixels.
param: integer  $scaleMethod  The method to use for scaling
return: \stdClass

sanitizeHeight($height, $width)   X-Ref
Method to sanitize a height value.

param: mixed  $height  The input height value to sanitize.
param: mixed  $width   The input width value for reference.
return: integer

sanitizeOffset($offset)   X-Ref
Method to sanitize an offset value like left or top.

param: mixed  $offset  An offset value.
return: integer

sanitizeWidth($width, $height)   X-Ref
Method to sanitize a width value.

param: mixed  $width   The input width value to sanitize.
param: mixed  $height  The input height value for reference.
return: integer

destroy()   X-Ref
Method to destroy an image handle and
free the memory associated with the handle

return: boolean  True on success, false on failure or if no image is loaded

__destruct()   X-Ref
Method to call the destroy() method one last time
to free any memory when the object is unset


setThumbnailGenerate($quality = true)   X-Ref
Method for set option of generate thumbnail method

param: boolean  $quality  True for best quality. False for best speed.
return: void



Generated: Wed Sep 7 05:41:13 2022 Chilli.vc Blog - For Webmaster,Blog-Writer,System Admin and Domainer