From 0a24cb0a2335ca303757c972eef3a986b5f39561 Mon Sep 17 00:00:00 2001 From: Constantine Nathanson <35217733+const-cloudinary@users.noreply.github.com> Date: Wed, 23 Oct 2024 14:52:19 +0300 Subject: [PATCH] Add support for `enhance` effect --- .../Effect/Generative/GenerativeEffect.php | 1 + .../Effect/Generative/GenerativeEffectTrait.php | 10 ++++++++++ .../Unit/Transformation/Image/GenerativeEffectTest.php | 8 ++++++++ 3 files changed, 19 insertions(+) diff --git a/src/Transformation/Effect/Generative/GenerativeEffect.php b/src/Transformation/Effect/Generative/GenerativeEffect.php index 1d7527c..3a7d4a4 100644 --- a/src/Transformation/Effect/Generative/GenerativeEffect.php +++ b/src/Transformation/Effect/Generative/GenerativeEffect.php @@ -20,6 +20,7 @@ abstract class GenerativeEffect const GENERATIVE_REPLACE = 'gen_replace'; const GENERATIVE_RESTORE = 'gen_restore'; const UPSCALE = 'upscale'; + const ENHANCE = 'enhance'; use GenerativeEffectTrait; } diff --git a/src/Transformation/Effect/Generative/GenerativeEffectTrait.php b/src/Transformation/Effect/Generative/GenerativeEffectTrait.php index aac8b32..0125376 100644 --- a/src/Transformation/Effect/Generative/GenerativeEffectTrait.php +++ b/src/Transformation/Effect/Generative/GenerativeEffectTrait.php @@ -85,4 +85,14 @@ public static function upscale() { return new GenerativeEffectAction(GenerativeEffect::UPSCALE); } + + /** + * Uses AI to analyze an image and make adjustments to enhance the appeal of the image. + * + * @return GenerativeEffectAction + */ + public static function enhance() + { + return new GenerativeEffectAction(GenerativeEffect::ENHANCE); + } } diff --git a/tests/Unit/Transformation/Image/GenerativeEffectTest.php b/tests/Unit/Transformation/Image/GenerativeEffectTest.php index f8e93d1..f6341fe 100644 --- a/tests/Unit/Transformation/Image/GenerativeEffectTest.php +++ b/tests/Unit/Transformation/Image/GenerativeEffectTest.php @@ -102,4 +102,12 @@ public function testGenerativeUpscale() (string)Effect::upscale() ); } + + public function testGenerativeEnhance() + { + self::assertStrEquals( + 'e_enhance', + Effect::enhance() + ); + } }