Image::scaleAndCrop

public Image::scaleAndCrop($width, $height) Scales an image to the exact width and height given. This function achieves the target aspect ratio by cropping the original image equally on both sides, or equally on the top and bottom. This function is useful to create uniform sized avatars from larger images. The resulting image always has the exact target dimensions. Parameters int $width: The target width, in pixels. int $height: The target height, in pixels. Return value bool TRUE on success,

Image::scale

public Image::scale($width, $height = NULL, $upscale = FALSE) Scales an image while maintaining aspect ratio. The resulting image can be smaller for one or both target dimensions. Parameters int|null $width: The target width, in pixels. If this value is null then the scaling will be based only on the height value. int|null $height: (optional) The target height, in pixels. If this value is null then the scaling will be based only on the width value. bool $upscale: (optional) Boolean indicating

Image::save

public Image::save($destination = NULL) Closes the image and saves the changes to a file. Parameters string|null $destination: (optional) Destination path where the image should be saved. If it is empty the original image file will be overwritten. Return value bool TRUE on success, FALSE on failure. Overrides ImageInterface::save See also \Drupal\Core\ImageToolkit\ImageToolkitInterface::save() File core/lib/Drupal/Core/Image/Image.php, line 118 Class Image Defines an image object to rep

Image::rotate

public Image::rotate($degrees, $background = NULL) Rotates an image by the given number of degrees. Parameters float $degrees: The number of (clockwise) degrees to rotate the image. string|null $background: (optional) An hexadecimal integer specifying the background color to use for the uncovered area of the image after the rotation; for example, 0x000000 for black, 0xff00ff for magenta, and 0xffffff for white. When NULL (the default) is specified, for images that support transparency, this wi

Image::resize

public Image::resize($width, $height) Resizes an image to the given dimensions (ignoring aspect ratio). Parameters int $width: The target width, in pixels. int $height: The target height, in pixels. Return value bool TRUE on success, FALSE on failure. Overrides ImageInterface::resize File core/lib/Drupal/Core/Image/Image.php, line 177 Class Image Defines an image object to represent an image file. Namespace Drupal\Core\Image Code public function resize($width, $height) { return $th

Image::isValid

public Image::isValid() Checks if the image is valid. Return value bool TRUE if the image object contains a valid image, FALSE otherwise. Overrides ImageInterface::isValid File core/lib/Drupal/Core/Image/Image.php, line 62 Class Image Defines an image object to represent an image file. Namespace Drupal\Core\Image Code public function isValid() { return $this->getToolkit()->isValid(); }

Image::getWidth

public Image::getWidth() Returns the width of the image. Return value int|null The width of the image, or NULL if the image is invalid. Overrides ImageInterface::getWidth File core/lib/Drupal/Core/Image/Image.php, line 76 Class Image Defines an image object to represent an image file. Namespace Drupal\Core\Image Code public function getWidth() { return $this->getToolkit()->getWidth(); }

Image::getToolkitId

public Image::getToolkitId() Returns the ID of the image toolkit used for this image file. Return value string The ID of the image toolkit. Overrides ImageInterface::getToolkitId File core/lib/Drupal/Core/Image/Image.php, line 104 Class Image Defines an image object to represent an image file. Namespace Drupal\Core\Image Code public function getToolkitId() { return $this->getToolkit()->getPluginId(); }

Image::getToolkit

public Image::getToolkit() Returns the image toolkit used for this image file. Return value \Drupal\Core\ImageToolkit\ImageToolkitInterface The image toolkit. Overrides ImageInterface::getToolkit File core/lib/Drupal/Core/Image/Image.php, line 111 Class Image Defines an image object to represent an image file. Namespace Drupal\Core\Image Code public function getToolkit() { return $this->toolkit; }

Image::getSource

public Image::getSource() Retrieves the source path of the image file. Return value string The source path of the image file. An empty string if the source is not set. Overrides ImageInterface::getSource File core/lib/Drupal/Core/Image/Image.php, line 97 Class Image Defines an image object to represent an image file. Namespace Drupal\Core\Image Code public function getSource() { return $this->source; }