Ok,
I finally found a solution, it was the custom captcha adapter what had to be 
passed as 'captcha' option instead of the options array. 
Almost went nuts on this...

        // Add a captcha
        $this->addElement('captcha', 'captcha', array(
            'label'      => 'write next 5 characters:',
            'required' => true
            'captcha'    => new My_Captcha_Image(array(
                'captcha' => 'Image',
                'font' => APPLICATION_PATH . '/fonts/Arial_Bold.ttf',
                'imgUrl' => '/images/captcha',
                'fontSize' => 30,
                'wordLen' => 5,
                'timeout' => 300
            )),
        ));
        $this->captcha->addPrefixPath('My_Captcha', 'My/Captcha/', 'captcha');

By the way, if anyone is using Debian. It seems that there is a casting bug or 
something like that in the imageftbbox function and returns -2147483648 on some 
of the coordinate numbers. (I suppose it may happen on other systems too...),  

I had to make this change to have the Image captcha working as it must, that's 
why I extend and overrided the _generateImage($id,$word) function:
Change:
 $texbox = imageftbbox($fsize, 0, $font, $word);
With:
 do{
     $textbox = imageftbbox($fsize, 0, $font, $word);
 }while(($textbox[2] == -2147483648));


Cheers,

-- 
Alayn Gortazar

----- "Alayn Gortazar" <[email protected]> escribió:

> Hi everybody,
> I'm trying to use a custom captcha adapter extending and overriding
> the Zend_Captcha_Image adapter.
> 
> The trouble is that when I try to use this adapter, Zend throws the
> next Exception:
> 
> ==============================
> Message: Plugin by name '' was not found in the registry; used paths:
> Zend_Captcha_: Zend/Captcha/ 
> ==============================
> 
> The code I'm using inside a Zend_Form class looks like this:
> =============================
>         // Add a captcha
>         $this->addElement('captcha', 'captcha', array(
>             'label'      => 'write next 5 characters:',
>             'captcha'    => array(
>                 'captcha' => new My_Captcha_Image(),
>                 'font' => APPLICATION_PATH . '/fonts/Arial_Bold.ttf',
>                 'imgUrl' => '/images/captcha',
>                 'fontSize' => 30,
>                 'wordLen' => 5,
>                 'timeout' => 300
>             ),
>         ));
>        
> $this->captcha->addPrefixPath('My_Captcha','My/Captcha','captcha');
> ==============================
> 
> Any idea of what I'm doing wrong??
> 
> -- 
> Alayn Gortazar

Reply via email to