Adding backgroundColor option (fixes #55)

This commit is contained in:
Gregwar
2013-04-22 00:32:40 +02:00
parent 45e4f72394
commit be90f19f3a
3 changed files with 11 additions and 1 deletions

View File

@ -95,6 +95,15 @@ class CaptchaGenerator
{
$this->builder->setDistortion($options['distortion']);
if ($options['backgroundColor'] != array()) {
if (count($options['backgroundColor'])!=3) {
throw new \RuntimeException('backgroundColor should be an array of r, g and b');
}
$color = $options['backgroundColor'];
$this->builder->setBackgroundColor($color[0], $color[1], $color[2]);
}
$fingerprint = isset($options['fingerprint']) ? $options['fingerprint'] : null;
$content = $this->builder->build(