Functions for image file manipulations.
Backdrop'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 Backdrop. 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 based on the associated module's hook_image_toolkits. Additionally the image toolkit include file must be identified in the files array in the module.info file. 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 image_get_available_toolkits(), and then calling its functions directly.
includes/ image.inc, line 7
- API for manipulating images.
||Crops an image to a rectangle specified by the given dimensions.|
||Converts an image to grayscale.|
||Scales image dimensions while maintaining aspect ratio.|
||Verify GD2 settings (that the right version is actually installed).|
||Create a truecolor image preserving transparency from a provided image.|
||Crop an image using the GD toolkit.|
||Convert an image resource to grayscale.|
||Get details about an image.|
||GD helper function to create an image resource from a file.|
||Scale an image to the specified size using GD.|
||Rotate an image the given number of degrees.|
||GD helper to write an image resource to a destination file.|
||Retrieve settings for the GD2 toolkit.|
||Gets a list of available toolkits.|
||Gets details about an image.|
||Gets the name of the currently used toolkit.|
||Converts a hex string to RGBA (red, green, blue, alpha) integer values and tidies up the input hex color string.|
||Loads an image file and returns an image object.|
||Resizes an image to the given dimensions (ignoring aspect ratio).|
||Rotates an image by the given number of degrees.|
||Closes the image and saves the changes to a file.|
||Scales an image while maintaining aspect ratio.|
||Scales an image to the exact width and height given.|
||Invokes the given method using the currently selected toolkit.|