ImageToolkitInterface
interface ImageToolkitInterface implements ContainerFactoryPluginInterface, PluginInspectionInterface, PluginFormInterface (View source)
Defines an interface for image toolkits.
An image toolkit provides common image file manipulations like scaling, cropping, and rotating.
Methods
Creates an instance of the plugin.
Gets the definition of the plugin implementation.
Sets the source path of the image file.
Gets the source path of the image file.
Checks if the image is valid.
Writes an image resource to a destination file.
Determines if a file contains a valid image.
Returns the height of the image.
Returns the width of the image.
Returns the MIME type of the image file.
Gets toolkit requirements in a format suitable for hook_requirements().
Verifies that the Image Toolkit is set up correctly.
Returns a list of image file extensions supported by the toolkit.
Applies a toolkit operation to an image.
Details
static ContainerFactoryPluginInterface
create(ContainerInterface $container, array $configuration, string $plugin_id, mixed $plugin_definition)
Creates an instance of the plugin.
string
getPluginId()
Gets the plugin_id of the plugin instance.
array
getPluginDefinition()
Gets the definition of the plugin implementation.
array
buildConfigurationForm(array $form, FormStateInterface $form_state)
Form constructor.
Plugin forms are embedded in other forms. In order to know where the plugin form is located in the parent form, #parents and #array_parents must be known, but these are not available during the initial build phase. In order to have these properties available when building the plugin form's elements, let this method return a form element that has a #process callback and build the rest of the form in the callback. By the time the callback is executed, the element's #parents and #array_parents properties will have been set by the form API. For more documentation on #parents and
array_parents, see \Drupal\Core\Render\Element\FormElement.
validateConfigurationForm(array $form, FormStateInterface $form_state)
Form validation handler.
submitConfigurationForm(array $form, FormStateInterface $form_state)
Form submission handler.
$this
setSource(string $source)
Sets the source path of the image file.
string
getSource()
Gets the source path of the image file.
bool
isValid()
Checks if the image is valid.
bool
save(string $destination)
Writes an image resource to a destination file.
bool
parseFile()
Determines if a file contains a valid image.
Drupal supports GIF, JPG and PNG file formats when used with the GD toolkit, and may support others, depending on which toolkits are installed.
int|null
getHeight()
Returns the height of the image.
int|null
getWidth()
Returns the width of the image.
string
getMimeType()
Returns the MIME type of the image file.
array
getRequirements()
Gets toolkit requirements in a format suitable for hook_requirements().
static bool
isAvailable()
Verifies that the Image Toolkit is set up correctly.
static array
getSupportedExtensions()
Returns a list of image file extensions supported by the toolkit.
bool
apply(string $operation, array $arguments = [])
Applies a toolkit operation to an image.