W3cubDocs

/Drupal 8

class Image

Defines an image object to represent an image file.

Hierarchy

See also

\Drupal\Core\ImageToolkit\ImageToolkitInterface

\Drupal\image\ImageEffectInterface

Related topics

Image toolkits
Functions for image file manipulations.

File

core/lib/Drupal/Core/Image/Image.php, line 15

Namespace

Drupal\Core\Image

Members

Name Modifiers Type Description
Image::$fileSize protected property File size in bytes.
Image::$source protected property Path of the image file.
Image::$toolkit protected property An image toolkit object.
Image::apply public function Applies a toolkit operation to the image. Overrides ImageInterface::apply
Image::chmod protected function Provides a wrapper for drupal_chmod() to allow unit testing.
Image::convert public function Instructs the toolkit to save the image in the format specified by the extension. Overrides ImageInterface::convert
Image::createNew public function Prepares a new image, without loading it from a file. Overrides ImageInterface::createNew
Image::crop public function Crops an image to a rectangle specified by the given dimensions. Overrides ImageInterface::crop
Image::desaturate public function Converts an image to grayscale. Overrides ImageInterface::desaturate
Image::getFileSize public function Returns the size of the image file. Overrides ImageInterface::getFileSize
Image::getHeight public function Returns the height of the image. Overrides ImageInterface::getHeight
Image::getMimeType public function Returns the MIME type of the image file. Overrides ImageInterface::getMimeType
Image::getSource public function Retrieves the source path of the image file. Overrides ImageInterface::getSource
Image::getToolkit public function Returns the image toolkit used for this image file. Overrides ImageInterface::getToolkit
Image::getToolkitId public function Returns the ID of the image toolkit used for this image file. Overrides ImageInterface::getToolkitId
Image::getWidth public function Returns the width of the image. Overrides ImageInterface::getWidth
Image::isValid public function Checks if the image is valid. Overrides ImageInterface::isValid
Image::resize public function Resizes an image to the given dimensions (ignoring aspect ratio). Overrides ImageInterface::resize
Image::rotate public function Rotates an image by the given number of degrees. Overrides ImageInterface::rotate
Image::save public function Closes the image and saves the changes to a file. Overrides ImageInterface::save
Image::scale public function Scales an image while maintaining aspect ratio. Overrides ImageInterface::scale
Image::scaleAndCrop public function Scales an image to the exact width and height given. Overrides ImageInterface::scaleAndCrop
Image::__construct public function Constructs a new Image object.

© 2001–2016 by the original authors
Licensed under the GNU General Public License, version 2 and later.
Drupal is a registered trademark of Dries Buytaert.
https://api.drupal.org/api/drupal/core!lib!Drupal!Core!Image!Image.php/class/Image/8.1.x