From a1da8e287a45a641a833af1341e0abdda51eb03d Mon Sep 17 00:00:00 2001 From: Oliver Vogel Date: Tue, 19 Dec 2023 16:36:32 +0100 Subject: [PATCH] Refactor code --- src/Drivers/Gd/Encoders/WebpEncoder.php | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/src/Drivers/Gd/Encoders/WebpEncoder.php b/src/Drivers/Gd/Encoders/WebpEncoder.php index d6a1ef76..23939a3c 100644 --- a/src/Drivers/Gd/Encoders/WebpEncoder.php +++ b/src/Drivers/Gd/Encoders/WebpEncoder.php @@ -13,9 +13,8 @@ class WebpEncoder extends DriverSpecializedEncoder { public function encode(ImageInterface $image): EncodedImage { - $gd = $image->core()->native(); - $data = $this->getBuffered(function () use ($gd) { - imagewebp($gd, null, $this->quality); + $data = $this->getBuffered(function () use ($image) { + imagewebp($image->core()->native(), null, $this->quality); }); return new EncodedImage($data, 'image/webp');