Skip to main content
Drupal API
User account menu
  • Log in

Breadcrumb

  1. Drupal Core 11.1.x
  2. ImageToolkitBase.php

function ImageToolkitBase::apply

Overrides ImageToolkitInterface::apply

1 call to ImageToolkitBase::apply()
GDToolkit::load in core/modules/system/src/Plugin/ImageToolkit/GDToolkit.php
Loads an image from a file.

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) {
        $this->logger
            ->error("The selected image handling toolkit '@toolkit' can not process operation '@operation'.", [
            '@toolkit' => $this->getPluginId(),
            '@operation' => $operation,
        ]);
        return FALSE;
    } catch (\Throwable $t) {
        $this->logger
            ->warning("The image toolkit '@toolkit' failed processing '@operation' for image '@image'. Reported error: @class - @message", [
            '@toolkit' => $this->getPluginId(),
            '@operation' => $operation,
            '@image' => $this->getSource(),
            '@class' => get_class($t),
            '@message' => $t->getMessage(),
        ]);
        return FALSE;
    }
}

API Navigation

  • Drupal Core 11.1.x
  • Topics
  • Classes
  • Functions
  • Constants
  • Globals
  • Files
  • Namespaces
  • Deprecated
  • Services
RSS feed
Powered by Drupal