Loading src/Plugin/ImageToolkit/Operation/gd/DrawRectangle.php +2 −2 Original line number Diff line number Diff line Loading @@ -28,7 +28,7 @@ class DrawRectangle extends GDImageToolkitOperationBase { $success = TRUE; if ($arguments['fill_color']) { $color = $this->allocateColorFromRgba($arguments['fill_color']); // @todo cleanup once PHP 8.0 is the minimum supported. // @todo cleanup once once Drupal 9 is no longer supported. if (PHP_VERSION_ID >= 80000) { $success = imagefilledpolygon($this->getToolkit()->getResource(), $this->getRectangleCorners($arguments['rectangle']), $color); } Loading @@ -38,7 +38,7 @@ class DrawRectangle extends GDImageToolkitOperationBase { } if ($success && $arguments['border_color']) { $color = $this->allocateColorFromRgba($arguments['border_color']); // @todo cleanup once PHP 8.0 is the minimum supported. // @todo cleanup once once Drupal 9 is no longer supported. if (PHP_VERSION_ID >= 80000) { $success = imagepolygon($this->getToolkit()->getResource(), $this->getRectangleCorners($arguments['rectangle']), $color); } Loading src/Plugin/ImageToolkit/Operation/gd/GDOperationTrait.php +2 −1 Original line number Diff line number Diff line Loading @@ -124,7 +124,8 @@ trait GDOperationTrait { // @todo when #2583041 is committed, add a check for memory // availability before creating the resource. $cut = imagecreatetruecolor($src_w, $src_h); // @todo remove the is_resource check when PHP 8.0 is minimum version. // @todo remove the is_resource check once Drupal 9 is no longer // supported. if (!is_object($cut) && !is_resource($cut)) { return FALSE; } Loading src/Plugin/ImageToolkit/Operation/gd/GaussianBlur.php +1 −1 Original line number Diff line number Diff line Loading @@ -26,7 +26,7 @@ class GaussianBlur extends GDImageToolkitOperationBase { */ protected function execute(array $arguments) { $blur = $this->imageCopyGaussianBlurred($this->getToolkit()->getResource(), $arguments['radius'], $arguments['sigma']); // @todo remove the is_resource check when PHP 8.0 is minimum version. // @todo remove the is_resource check once Drupal 9 is no longer supported. if ((is_object($blur) && $blur instanceof \GdImage) || is_resource($blur)) { $original_resource = $this->getToolkit()->getResource(); $this->getToolkit()->setResource($blur); Loading src/Plugin/ImageToolkit/Operation/imagemagick/Background.php +0 −5 Original line number Diff line number Diff line Loading @@ -44,13 +44,8 @@ class Background extends ImagemagickImageToolkitOperationBase { $w = $arguments['background_image']->getToolkit()->getWidth(); $h = $arguments['background_image']->getToolkit()->getHeight(); // Reverse offset sign. Offset arguments require a sign in front. // @todo the minus before $arguments gives issues to PHPCS, either as is // or with a space in between the minus and the variable. See if later // sniffs fix that. // @codingStandardsIgnoreStart $x = $arguments['x_offset'] > 0 ? ('-' . $arguments['x_offset']) : ('+' . -$arguments['x_offset']); $y = $arguments['y_offset'] > 0 ? ('-' . $arguments['y_offset']) : ('+' . -$arguments['y_offset']); // @codingStandardsIgnoreEnd $op .= " -extent {$w}x{$h}{$x}{$y} "; // Add the background image. Loading tests/src/Functional/Effect/BackgroundTest.php +1 −2 Original line number Diff line number Diff line Loading @@ -99,12 +99,11 @@ class BackgroundTest extends ImageEffectsTestBase { ]); // The operation replaced the resource, check that the old one has // been destroyed. // @todo remove once Drupal 9 is no longer supported. if (PHP_VERSION_ID < 80000) { $new_res = $image->getToolkit()->getResource(); $this->assertIsResource($new_res); $this->assertNotEquals($new_res, $old_res); // @todo In https://www.drupal.org/node/3133236 convert this to // $this->assertIsNotResource($old_res). $this->assertFalse(is_resource($old_res)); } // Save image and compare against original, should differ. Loading Loading
src/Plugin/ImageToolkit/Operation/gd/DrawRectangle.php +2 −2 Original line number Diff line number Diff line Loading @@ -28,7 +28,7 @@ class DrawRectangle extends GDImageToolkitOperationBase { $success = TRUE; if ($arguments['fill_color']) { $color = $this->allocateColorFromRgba($arguments['fill_color']); // @todo cleanup once PHP 8.0 is the minimum supported. // @todo cleanup once once Drupal 9 is no longer supported. if (PHP_VERSION_ID >= 80000) { $success = imagefilledpolygon($this->getToolkit()->getResource(), $this->getRectangleCorners($arguments['rectangle']), $color); } Loading @@ -38,7 +38,7 @@ class DrawRectangle extends GDImageToolkitOperationBase { } if ($success && $arguments['border_color']) { $color = $this->allocateColorFromRgba($arguments['border_color']); // @todo cleanup once PHP 8.0 is the minimum supported. // @todo cleanup once once Drupal 9 is no longer supported. if (PHP_VERSION_ID >= 80000) { $success = imagepolygon($this->getToolkit()->getResource(), $this->getRectangleCorners($arguments['rectangle']), $color); } Loading
src/Plugin/ImageToolkit/Operation/gd/GDOperationTrait.php +2 −1 Original line number Diff line number Diff line Loading @@ -124,7 +124,8 @@ trait GDOperationTrait { // @todo when #2583041 is committed, add a check for memory // availability before creating the resource. $cut = imagecreatetruecolor($src_w, $src_h); // @todo remove the is_resource check when PHP 8.0 is minimum version. // @todo remove the is_resource check once Drupal 9 is no longer // supported. if (!is_object($cut) && !is_resource($cut)) { return FALSE; } Loading
src/Plugin/ImageToolkit/Operation/gd/GaussianBlur.php +1 −1 Original line number Diff line number Diff line Loading @@ -26,7 +26,7 @@ class GaussianBlur extends GDImageToolkitOperationBase { */ protected function execute(array $arguments) { $blur = $this->imageCopyGaussianBlurred($this->getToolkit()->getResource(), $arguments['radius'], $arguments['sigma']); // @todo remove the is_resource check when PHP 8.0 is minimum version. // @todo remove the is_resource check once Drupal 9 is no longer supported. if ((is_object($blur) && $blur instanceof \GdImage) || is_resource($blur)) { $original_resource = $this->getToolkit()->getResource(); $this->getToolkit()->setResource($blur); Loading
src/Plugin/ImageToolkit/Operation/imagemagick/Background.php +0 −5 Original line number Diff line number Diff line Loading @@ -44,13 +44,8 @@ class Background extends ImagemagickImageToolkitOperationBase { $w = $arguments['background_image']->getToolkit()->getWidth(); $h = $arguments['background_image']->getToolkit()->getHeight(); // Reverse offset sign. Offset arguments require a sign in front. // @todo the minus before $arguments gives issues to PHPCS, either as is // or with a space in between the minus and the variable. See if later // sniffs fix that. // @codingStandardsIgnoreStart $x = $arguments['x_offset'] > 0 ? ('-' . $arguments['x_offset']) : ('+' . -$arguments['x_offset']); $y = $arguments['y_offset'] > 0 ? ('-' . $arguments['y_offset']) : ('+' . -$arguments['y_offset']); // @codingStandardsIgnoreEnd $op .= " -extent {$w}x{$h}{$x}{$y} "; // Add the background image. Loading
tests/src/Functional/Effect/BackgroundTest.php +1 −2 Original line number Diff line number Diff line Loading @@ -99,12 +99,11 @@ class BackgroundTest extends ImageEffectsTestBase { ]); // The operation replaced the resource, check that the old one has // been destroyed. // @todo remove once Drupal 9 is no longer supported. if (PHP_VERSION_ID < 80000) { $new_res = $image->getToolkit()->getResource(); $this->assertIsResource($new_res); $this->assertNotEquals($new_res, $old_res); // @todo In https://www.drupal.org/node/3133236 convert this to // $this->assertIsNotResource($old_res). $this->assertFalse(is_resource($old_res)); } // Save image and compare against original, should differ. Loading