[Configuration] Added JPEG quality node (fixes #13)

This commit is contained in:
Gregwar
2011-12-14 10:35:10 +01:00
parent 53e5605103
commit f9c57e6970
4 changed files with 19 additions and 3 deletions

View File

@ -83,6 +83,12 @@ class CaptchaType extends AbstractType
*/
protected $font;
/**
* Captcha quality
* @var int
*/
protected $quality;
/**
* Maximum age of images in minutes
* @var int
@ -117,6 +123,7 @@ class CaptchaType extends AbstractType
$this->gcFreq = $config['gc_freq'];
$this->expiration = $config['expiration'];
$this->font = $config['font'];
$this->quality = $config['quality'];
}
public function buildForm(FormBuilder $builder, array $options)
@ -136,7 +143,7 @@ class CaptchaType extends AbstractType
$fingerprint = $this->session->get($this->key.'_fingerprint');
}
$generator = new CaptchaGenerator($this->generateCaptchaValue(), $this->imageFolder, $this->webPath, $this->gcFreq, $this->expiration, $this->font, $fingerprint);
$generator = new CaptchaGenerator($this->generateCaptchaValue(), $this->imageFolder, $this->webPath, $this->gcFreq, $this->expiration, $this->font, $fingerprint, $this->quality);
if ($this->asFile) {
$view->set('captcha_code', $generator->getFile($this->width, $this->height));