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

Breadcrumb

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

function Scale::execute

Overrides Resize::execute

File

core/modules/system/src/Plugin/ImageToolkit/Operation/gd/Scale.php, line 83

Class

Scale
Defines GD2 Scale operation.

Namespace

Drupal\system\Plugin\ImageToolkit\Operation\gd

Code

protected function execute(array $arguments = []) {
    // Don't scale if we don't change the dimensions at all.
    if ($arguments['width'] !== $this->getToolkit()
        ->getWidth() || $arguments['height'] !== $this->getToolkit()
        ->getHeight()) {
        // Don't upscale if the option isn't enabled.
        if ($arguments['upscale'] || $arguments['width'] <= $this->getToolkit()
            ->getWidth() && $arguments['height'] <= $this->getToolkit()
            ->getHeight()) {
            return parent::execute($arguments);
        }
    }
    return TRUE;
}

API Navigation

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