[Configuration] Adding font (fixes #9)

This commit is contained in:
Gregwar
2011-12-02 19:07:28 +01:00
parent 124f3f8ece
commit 726f21e2ad
4 changed files with 24 additions and 5 deletions

View File

@ -74,13 +74,19 @@ class CaptchaType extends AbstractType
* Frequence of garbage collection in fractions of 1
* @var int
*/
public $gcFreq;
protected $gcFreq;
/**
* Captcha font
* @var string
*/
protected $font;
/**
* Maximum age of images in minutes
* @var int
*/
public $expiration;
protected $expiration;
/**
* The session
@ -109,6 +115,7 @@ class CaptchaType extends AbstractType
$this->webPath = $config['web_path'];
$this->gcFreq = $config['gc_freq'];
$this->expiration = $config['expiration'];
$this->font = $config['font'];
}
public function buildForm(FormBuilder $builder, array $options)
@ -121,7 +128,7 @@ class CaptchaType extends AbstractType
public function buildView(FormView $view, FormInterface $form)
{
$generator = new CaptchaGenerator($this->generateCaptchaValue(), $this->imageFolder, $this->webPath, $this->gcFreq, $this->expiration);
$generator = new CaptchaGenerator($this->generateCaptchaValue(), $this->imageFolder, $this->webPath, $this->gcFreq, $this->expiration, $this->font);
if ($this->asFile) {
$view->set('captcha_code', $generator->getFile($this->width, $this->height));