From 44c4f39cd45cdb31586b3d1f7850569a410f1a3a Mon Sep 17 00:00:00 2001 From: Tim Van Dijck Date: Thu, 21 Nov 2024 16:53:51 +0100 Subject: [PATCH] Fix adding orientation as a manipulation. --- src/Conversions/Manipulations.php | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/Conversions/Manipulations.php b/src/Conversions/Manipulations.php index f69114aae..0f54226fa 100644 --- a/src/Conversions/Manipulations.php +++ b/src/Conversions/Manipulations.php @@ -9,6 +9,7 @@ use Spatie\Image\Enums\CropPosition; use Spatie\Image\Enums\Fit; use Spatie\Image\Enums\FlipDirection; +use Spatie\Image\Enums\Orientation; /** @mixin \Spatie\Image\Drivers\ImageDriver */ class Manipulations @@ -59,6 +60,7 @@ public function apply(ImageDriver $image): void { foreach ($this->manipulations as $manipulationName => $parameters) { $parameters = $this->transformParameters($manipulationName, $parameters); + ray('apply', $manipulationName, gettype($parameters), $parameters)->orange(); $image->$manipulationName(...$parameters); } } @@ -129,6 +131,11 @@ public function transformParameters(int|string $manipulationName, mixed $paramet $parameters['flip'] = FlipDirection::from($parameters['flip']); } break; + case 'orientation': + if (isset($parameters['orientation']) && ! $parameters['orientation'] instanceof Orientation) { + $parameters['orientation'] = Orientation::from($parameters['orientation']); + } + break; default: break; }