public function ImageToolkitBase::apply in Drupal 8
Same name and namespace in other branches
- 9 core/lib/Drupal/Core/ImageToolkit/ImageToolkitBase.php \Drupal\Core\ImageToolkit\ImageToolkitBase::apply()
- 10 core/lib/Drupal/Core/ImageToolkit/ImageToolkitBase.php \Drupal\Core\ImageToolkit\ImageToolkitBase::apply()
Applies a toolkit operation to an image.
Parameters
string $operation: The toolkit operation to be processed.
array $arguments: An associative array of arguments to be passed to the toolkit operation, e.g. array('width' => 50, 'height' => 100, 'upscale' => TRUE).
Return value
bool TRUE if the operation was performed successfully, FALSE otherwise.
Overrides ImageToolkitInterface::apply
1 call to ImageToolkitBase::apply()
- GDToolkit::load in core/
modules/ system/ src/ Plugin/ ImageToolkit/ GDToolkit.php - Loads a GD resource from a file.
1 method overrides ImageToolkitBase::apply()
- TestToolkit::apply in core/
modules/ system/ tests/ modules/ image_test/ src/ Plugin/ ImageToolkit/ TestToolkit.php - Applies a toolkit operation to an image.
File
- core/
lib/ Drupal/ Core/ ImageToolkit/ ImageToolkitBase.php, line 121
Class
- ImageToolkitBase
- Provides a base class for image toolkit plugins.
Namespace
Drupal\Core\ImageToolkitCode
public function apply($operation, array $arguments = []) {
try {
// Get the plugin to use for the operation and apply the operation.
return $this
->getToolkitOperation($operation)
->apply($arguments);
} catch (PluginNotFoundException $e) {
$this->logger
->error("The selected image handling toolkit '@toolkit' can not process operation '@operation'.", [
'@toolkit' => $this
->getPluginId(),
'@operation' => $operation,
]);
return FALSE;
} catch (\InvalidArgumentException $e) {
$this->logger
->warning($e
->getMessage(), []);
return FALSE;
}
}