Image toolkits
Same name in other branches
- 7.x includes/image.inc \image
- 9 core/lib/Drupal/Core/ImageToolkit/ImageToolkitInterface.php \Drupal\Core\ImageToolkit\image
- 8.9.x core/lib/Drupal/Core/ImageToolkit/ImageToolkitInterface.php \Drupal\Core\ImageToolkit\image
- 10 core/lib/Drupal/Core/ImageToolkit/ImageToolkitInterface.php \Drupal\Core\ImageToolkit\image
Functions for image file manipulations.
Drupal's image toolkits provide an abstraction layer for common image file manipulations like scaling, cropping, and rotating. The abstraction frees module authors from the need to support multiple image libraries, and it allows site administrators to choose the library that's best for them.
PHP includes the GD library by default so a GD toolkit is installed with Drupal. Other toolkits like ImageMagick are available from contrib modules. GD works well for small images, but using it with larger files may cause PHP to run out of memory. In contrast the ImageMagick library does not suffer from this problem, but it requires the ISP to have installed additional software.
Image toolkits are discovered using the Plugin system using \Drupal\Core\ImageToolkit\ImageToolkitManager. The toolkit must then be enabled using the admin/config/media/image-toolkit form.
Only one toolkit may be selected at a time. If a module author wishes to call a specific toolkit they can check that it is installed by calling \Drupal\Core\ImageToolkit\ImageToolkitManager::getAvailableToolkits(), and then calling its functions directly.
File
-
core/
lib/ Drupal/ Core/ ImageToolkit/ ImageToolkitInterface.php, line 9
Classes
Title Sort descending | File name | Summary |
---|---|---|
Image | core/ |
Defines an image object to represent an image file. |
Interfaces
Title Sort descending | File name | Summary |
---|---|---|
ImageToolkitInterface | core/ |
Defines an interface for image toolkits. |
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.