function ImageToolkitBase::apply

Same name and namespace in other branches
  1. 11.x core/lib/Drupal/Core/ImageToolkit/ImageToolkitBase.php \Drupal\Core\ImageToolkit\ImageToolkitBase::apply()
  2. 10 core/lib/Drupal/Core/ImageToolkit/ImageToolkitBase.php \Drupal\Core\ImageToolkit\ImageToolkitBase::apply()
  3. 8.9.x core/lib/Drupal/Core/ImageToolkit/ImageToolkitBase.php \Drupal\Core\ImageToolkit\ImageToolkitBase::apply()

File

core/lib/Drupal/Core/ImageToolkit/ImageToolkitBase.php, line 121

Class

ImageToolkitBase
Provides a base class for image toolkit plugins.

Namespace

Drupal\Core\ImageToolkit

Code

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;
  }
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.