From 7d8958f68585955d92b6ed436dc4b5254430daef Mon Sep 17 00:00:00 2001 From: Matronator <5470780+matronator@users.noreply.github.com> Date: Thu, 4 Nov 2021 15:45:26 +0100 Subject: [PATCH] Add option to ignore postEffects Adds an option to only ignore postEffects (edge, negate, contrast, colorize) while keeping the other effects (behind/front lines, distortion) intact --- src/Gregwar/Captcha/CaptchaBuilder.php | 22 +++++++++++++++++++++- 1 file changed, 21 insertions(+), 1 deletion(-) diff --git a/src/Gregwar/Captcha/CaptchaBuilder.php b/src/Gregwar/Captcha/CaptchaBuilder.php index 4d53639..003fe85 100644 --- a/src/Gregwar/Captcha/CaptchaBuilder.php +++ b/src/Gregwar/Captcha/CaptchaBuilder.php @@ -99,6 +99,13 @@ class CaptchaBuilder implements CaptchaBuilderInterface */ protected $ignoreAllEffects = false; + /** + * Ignore post effects + * + * @var bool + */ + protected $ignorePostEffects = false; + /** * Allowed image types for the background images * @@ -254,6 +261,19 @@ public function setIgnoreAllEffects($ignoreAllEffects) return $this; } + /** + * Sets the ignorePostEffects value + * + * @param bool $ignorePostEffects + * @return CaptchaBuilder + */ + public function setIgnorePostEffects($ignorePostEffects) + { + $this->ignorePostEffects = $ignorePostEffects; + + return $this; + } + /** * Sets the list of background images to use (one image is randomly selected) */ @@ -481,7 +501,7 @@ public function build($width = 150, $height = 40, $font = null, $fingerprint = n } // Post effects - if (!$this->ignoreAllEffects) { + if (!$this->ignoreAllEffects && !$this->ignorePostEffects) { $this->postEffect($image); }