Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add option to ignore postEffects #95

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 21 additions & 1 deletion src/Gregwar/Captcha/CaptchaBuilder.php
Original file line number Diff line number Diff line change
Expand Up @@ -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
*
Expand Down Expand Up @@ -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)
*/
Expand Down Expand Up @@ -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);
}

Expand Down