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 e548a23..84ffc5f 100644 --- a/tests/TransformationTest.php +++ b/tests/TransformationTest.php @@ -199,6 +199,13 @@ 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/'); +}); + it('uses the correct amount argument in blur', function () { expect((string) uploadcare('12a3456b-c789-1234-1de2-3cfa83096e25')->blur(10, 5))->toContain('-/blur/10/5/'); });