Skip to content

Commit

Permalink
Merge pull request #243 from ialireza/master
Browse files Browse the repository at this point in the history
add marginTop to config for imagick driver.
  • Loading branch information
mewebstudio committed Jul 20, 2022
2 parents c4dec49 + a099cff commit 29444eb
Showing 1 changed file with 12 additions and 4 deletions.
16 changes: 12 additions & 4 deletions src/Captcha.php
Expand Up @@ -188,7 +188,12 @@ class Captcha
* @var bool
*/
protected $encrypt = true;


/**
* @var int
*/
protected $marginTop = 0;

/**
* Constructor
*
Expand Down Expand Up @@ -342,7 +347,7 @@ protected function generate(): array

$hash = $this->hasher->make($key);
if($this->encrypt) $hash = Crypt::encrypt($hash);

$this->session->put('captcha', [
'sensitive' => $this->sensitive,
'key' => $hash,
Expand All @@ -364,6 +369,9 @@ protected function generate(): array
protected function text(): void
{
$marginTop = $this->image->height() / $this->length;
if ($this->marginTop !== 0) {
$marginTop = $this->marginTop;
}

$text = $this->text;
if (is_string($text)) {
Expand Down Expand Up @@ -483,7 +491,7 @@ public function check(string $value): bool

return $check;
}

/**
* Returns the md5 short version of the key for cache
*
Expand All @@ -492,7 +500,7 @@ public function check(string $value): bool
*/
protected function get_cache_key($key) {
return 'captcha_' . md5($key);
}
}

/**
* Captcha check
Expand Down

0 comments on commit 29444eb

Please sign in to comment.