diff --git a/core/modules/system/lib/Drupal/system/Plugin/ImageToolkit/Operation/gd/Crop.php b/core/modules/system/lib/Drupal/system/Plugin/ImageToolkit/Operation/gd/Crop.php index af0e3a2..d0fbecb 100644 --- a/core/modules/system/lib/Drupal/system/Plugin/ImageToolkit/Operation/gd/Crop.php +++ b/core/modules/system/lib/Drupal/system/Plugin/ImageToolkit/Operation/gd/Crop.php @@ -63,14 +63,14 @@ public function prepare(ImageInterface $image, array &$arguments) { public function apply(ImageInterface $image, array $arguments = array()) { $res = $this->toolkit->createTmp($image, $arguments['width'], $arguments['height']); - if (!imagecopyresampled($res, $image->getResource(), 0, 0, $arguments['x'], $arguments['y'], $arguments['width'], $arguments['height'], $arguments['width'], $arguments['height'])) { + if (!imagecopyresampled($res, $image->getToolkit()->getResource(), 0, 0, $arguments['x'], $arguments['y'], $arguments['width'], $arguments['height'], $arguments['width'], $arguments['height'])) { return FALSE; } // Destroy the original image and return the modified image. - imagedestroy($image->getResource()); + imagedestroy($image->getToolkit()->getResource()); + $image->getToolkit()->setResource($res); $image - ->setResource($res) ->setWidth($arguments['width']) ->setHeight($arguments['height']); return TRUE; diff --git a/core/modules/system/lib/Drupal/system/Plugin/ImageToolkit/Operation/gd/Desaturate.php b/core/modules/system/lib/Drupal/system/Plugin/ImageToolkit/Operation/gd/Desaturate.php index 8c321df..4a51a6e 100644 --- a/core/modules/system/lib/Drupal/system/Plugin/ImageToolkit/Operation/gd/Desaturate.php +++ b/core/modules/system/lib/Drupal/system/Plugin/ImageToolkit/Operation/gd/Desaturate.php @@ -33,7 +33,7 @@ public function apply(ImageInterface $image, array $arguments = array()) { return FALSE; } - return imagefilter($image->getResource(), IMG_FILTER_GRAYSCALE); + return imagefilter($image->getToolkit()->getResource(), IMG_FILTER_GRAYSCALE); } } diff --git a/core/modules/system/lib/Drupal/system/Plugin/ImageToolkit/Operation/gd/Resize.php b/core/modules/system/lib/Drupal/system/Plugin/ImageToolkit/Operation/gd/Resize.php index 76daf78..e987ced 100644 --- a/core/modules/system/lib/Drupal/system/Plugin/ImageToolkit/Operation/gd/Resize.php +++ b/core/modules/system/lib/Drupal/system/Plugin/ImageToolkit/Operation/gd/Resize.php @@ -54,14 +54,14 @@ public function apply(ImageInterface $image, array $arguments = array()) { $res = $this->toolkit->createTmp($image, $arguments['width'], $arguments['height']); - if (!imagecopyresampled($res, $image->getResource(), 0, 0, 0, 0, $arguments['width'], $arguments['height'], $image->getWidth(), $image->getHeight())) { + if (!imagecopyresampled($res, $image->getToolkit()->getResource(), 0, 0, 0, 0, $arguments['width'], $arguments['height'], $image->getWidth(), $image->getHeight())) { return FALSE; } - imagedestroy($image->getResource()); + imagedestroy($image->getToolkit()->getResource()); // Update image object. + $image->getToolkit()->setResource($res); $image - ->setResource($res) ->setWidth($arguments['width']) ->setHeight($arguments['height']); return TRUE; diff --git a/core/modules/system/lib/Drupal/system/Plugin/ImageToolkit/Operation/gd/Rotate.php b/core/modules/system/lib/Drupal/system/Plugin/ImageToolkit/Operation/gd/Rotate.php index 560a7a1..b90e4f2 100644 --- a/core/modules/system/lib/Drupal/system/Plugin/ImageToolkit/Operation/gd/Rotate.php +++ b/core/modules/system/lib/Drupal/system/Plugin/ImageToolkit/Operation/gd/Rotate.php @@ -50,39 +50,39 @@ public function apply(ImageInterface $image, array $arguments = array()) { for ($i = 16; $i >= 0; $i -= 8) { $rgb[] = (($arguments['background'] >> $i) & 0xFF); } - $arguments['background'] = imagecolorallocatealpha($image->getResource(), $rgb[0], $rgb[1], $rgb[2], 0); + $arguments['background'] = imagecolorallocatealpha($image->getToolkit()->getResource(), $rgb[0], $rgb[1], $rgb[2], 0); } // Set background color as transparent if $arguments['background'] is NULL. else { // Get the current transparent color. - $arguments['background'] = imagecolortransparent($image->getResource()); + $arguments['background'] = imagecolortransparent($image->getToolkit()->getResource()); // If no transparent colors, use white. if ($arguments['background'] == 0) { - $arguments['background'] = imagecolorallocatealpha($image->getResource(), 255, 255, 255, 0); + $arguments['background'] = imagecolorallocatealpha($image->getToolkit()->getResource(), 255, 255, 255, 0); } } // Images are assigned a new color palette when rotating, removing any // transparency flags. For GIF images, keep a record of the transparent color. if ($image->getType() == IMAGETYPE_GIF) { - $transparent_index = imagecolortransparent($image->getResource()); + $transparent_index = imagecolortransparent($image->getToolkit()->getResource()); if ($transparent_index != 0) { - $transparent_gif_color = imagecolorsforindex($image->getResource(), $transparent_index); + $transparent_gif_color = imagecolorsforindex($image->getToolkit()->getResource(), $transparent_index); } } - $image->setResource(imagerotate($image->getResource(), 360 - $arguments['degrees'], $arguments['background'])); + $image->getToolkit()->setResource(imagerotate($image->getToolkit()->getResource(), 360 - $arguments['degrees'], $arguments['background'])); // GIFs need to reassign the transparent color after performing the rotate. if (isset($transparent_gif_color)) { - $arguments['background'] = imagecolorexactalpha($image->getResource(), $transparent_gif_color['red'], $transparent_gif_color['green'], $transparent_gif_color['blue'], $transparent_gif_color['alpha']); - imagecolortransparent($image->getResource(), $arguments['background']); + $arguments['background'] = imagecolorexactalpha($image->getToolkit()->getResource(), $transparent_gif_color['red'], $transparent_gif_color['green'], $transparent_gif_color['blue'], $transparent_gif_color['alpha']); + imagecolortransparent($image->getToolkit()->getResource(), $arguments['background']); } $image - ->setWidth(imagesx($image->getResource())) - ->setHeight(imagesy($image->getResource())); + ->setWidth(imagesx($image->getToolkit()->getResource())) + ->setHeight(imagesy($image->getToolkit()->getResource())); return TRUE; }