Issues

ZF-10627: Captcha string out of image

Issue Type: Improvement Created: 2010-11-02T14:08:53.000+0000 Last Updated: 2012-11-20T21:37:28.000+0000 Status: Open Fix version(s): Reporter: gaua (gaua) Assignee: None Tags: - Zend_Captcha

Related issues: Attachments:

Description

Sometimes captcha string is printed out of image so it is not visible.

class: Zend_Captcha_Image line 488: imagefilledrectangle($img, 0, 0, $w-1, $h-1, $bg_color); $textbox = imageftbbox($fsize, 0, $font, $word); $x = ($w - ($textbox[2] - $textbox[0])) / 2; $y = ($h - ($textbox[7] - $textbox[1])) / 2;

Don`t now why but sometimes $x gets huge value over 1000000. Probably there is some bug in imageftbbox function. I found that many other developers have same problem with captcha. Protection for $x value (maybe y also) will be very helpful because we (developers) do not have any possibility to protect our code. As result we get image with dots and lines but without any code.

Comments

Posted by Mickael Perraud (mikaelkael) on 2010-11-19T09:32:13.000+0000

Can you provide the configuration of the Captcha object?

Posted by gaua (gaua) on 2010-11-19T13:14:37.000+0000

class Core_Form_Element_Captcha_Image extends Zend_Form_Element_Captcha { public function __construct( $Name, $Options = null ) { $captchaImage = new Zend_Captcha_Image( 'captchaImg' );
$captchaImage->setFontSize(36) ->setLineNoiseLevel( 2 )
->setFont( APPLICATION_PATH . '/../public/fonts/12tonfishstick.ttf' )
->setWordlen(6)
->setWidth(176) ->setHeight(75);

    $Options['captcha'] = $captchaImage;

    parent::__construct( $Name, $Options );
}

}

It doesn`t happen very often. Sometimes I need to generate many captcha to get it.

Have you found an issue?

See the Overview section for more details.

Copyright

© 2006-2016 by Zend, a Rogue Wave Company. Made with by awesome contributors.

This website is built using zend-expressive and it runs on PHP 7.

Contacts