2008年9月30日星期二

Re: [fw-mvc] Zend_Form_Captcha_Image and GD Font path problem

-- S?ébastien Cramatte <scramatte@zensoluciones.com> wrote
(on Tuesday, 30 September 2008, 07:21 PM +0200):
> Hello,
>
> I'm running ZF 1.6 and I would like to test Zend_Form_Captcha_Image.
> My server runs debian lenny and php 5.2.3 with GD
>
> When I call the form with captcha element I obtain these error
>
> Warning: imageftbbox() [function.imageftbbox]: Could not find/open font
> in /home/vhosts/d/default/library/Zend/Captcha/Image.php on line 388
> Warning: imagefttext() [function.imagefttext]: Could not find/open font
> in /home/vhosts/d/default/library/Zend/Captcha/Image.php on line 391
>
>
> --- ZEND FORM extract ---
> ...
> $elt = new Zend_Form_Element_Captcha('foo', array(
> 'label' => "Please verify you're a human",
> 'captcha' => array(
> 'captcha' => 'Image',
> 'font' => 'arial',
> 'imgDir' => './share/img/captchas/',
> 'wordLen' => 6,
> 'timeout' => 300,
> ),
> ));
>
> $this->addElement($elt);
> ...
> ---
>
> I've installed arial.ttf in my www root and I've setup GDFONTPATH env
> variable to point to this dir.
> Unfortunately doesn't works

You need to specify the font file's extension (i.e., 'arial.ttf', not
just 'arial'); if that still doesn't work, you may need to specify the
full path to the font.

--
Matthew Weier O'Phinney
Software Architect | matthew@zend.com
Zend Framework | http://framework.zend.com/

没有评论: