function Scale::execute

Same name in other branches
  1. 9 core/modules/system/src/Plugin/ImageToolkit/Operation/gd/Scale.php \Drupal\system\Plugin\ImageToolkit\Operation\gd\Scale::execute()
  2. 8.9.x core/modules/system/src/Plugin/ImageToolkit/Operation/gd/Scale.php \Drupal\system\Plugin\ImageToolkit\Operation\gd\Scale::execute()
  3. 10 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 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;
}

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