function Scale::execute

Same name in other branches
  1. 8.9.x core/modules/system/src/Plugin/ImageToolkit/Operation/gd/Scale.php \Drupal\system\Plugin\ImageToolkit\Operation\gd\Scale::execute()
  2. 10 core/modules/system/src/Plugin/ImageToolkit/Operation/gd/Scale.php \Drupal\system\Plugin\ImageToolkit\Operation\gd\Scale::execute()
  3. 11.x core/modules/system/src/Plugin/ImageToolkit/Operation/gd/Scale.php \Drupal\system\Plugin\ImageToolkit\Operation\gd\Scale::execute()

Overrides Resize::execute

File

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

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

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