From 47ef0d4521ca46243b033db8430a320955b50a2d Mon Sep 17 00:00:00 2001 From: Baspa Date: Thu, 18 Jun 2026 14:58:22 +0200 Subject: [PATCH] fix: honor the boolean argument in autoRotate() --- src/Transformations.php | 2 +- src/Transformations/AutoRotate.php | 2 +- tests/TransformationTest.php | 7 +++++++ 3 files changed, 9 insertions(+), 2 deletions(-) diff --git a/src/Transformations.php b/src/Transformations.php index cd7794d..f0d9934 100644 --- a/src/Transformations.php +++ b/src/Transformations.php @@ -338,7 +338,7 @@ public function sharpen(int|null $strength = null): self */ public function autoRotate(bool $rotate): self { - $this->transformations['auto_rotate'] = AutoRotate::transform(); + $this->transformations['auto_rotate'] = AutoRotate::transform($rotate); return $this; } diff --git a/src/Transformations/AutoRotate.php b/src/Transformations/AutoRotate.php index 672e817..f7d64f3 100644 --- a/src/Transformations/AutoRotate.php +++ b/src/Transformations/AutoRotate.php @@ -10,7 +10,7 @@ class AutoRotate implements TransformationInterface public static function transform(...$args): array { - $autoRotate = $args['auto_rotate'] ?? false; + $autoRotate = $args[0] ?? false; return [ self::AUTO_ROTATE => $autoRotate, diff --git a/tests/TransformationTest.php b/tests/TransformationTest.php index 16082cc..b37a95b 100644 --- a/tests/TransformationTest.php +++ b/tests/TransformationTest.php @@ -198,3 +198,10 @@ $url = (string) $transformation->stripMeta('sensitive'); expect($url)->toBe('https://ucarecdn.com/12a3456b-c789-1234-1de2-3cfa83096e25/-/strip_meta/sensitive/'); }); + +it('honors the boolean argument in autoRotate', function () { + $uuid = '12a3456b-c789-1234-1de2-3cfa83096e25'; + + expect((string) uploadcare($uuid)->autoRotate(true))->toContain('-/autorotate/yes/'); + expect((string) uploadcare($uuid)->autoRotate(false))->toContain('-/autorotate/no/'); +});