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

Breadcrumb

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

function Desaturate::execute

Overrides ImageToolkitOperationBase::execute

File

core/modules/system/src/Plugin/ImageToolkit/Operation/gd/Desaturate.php, line 31

Class

Desaturate
Defines GD2 Desaturate operation.

Namespace

Drupal\system\Plugin\ImageToolkit\Operation\gd

Code

protected function execute(array $arguments) {
    // PHP installations using non-bundled GD do not have imagefilter.
    if (!function_exists('imagefilter')) {
        $this->logger
            ->notice("The image '@file' could not be desaturated because the imagefilter() function is not available in this PHP installation.", [
            '@file' => $this->getToolkit()
                ->getSource(),
        ]);
        return FALSE;
    }
    return imagefilter($this->getToolkit()
        ->getImage(), IMG_FILTER_GRAYSCALE);
}

API Navigation

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