I would like to override below file
magento\vendor\magento\zendframework1\library\Zend\Captcha\Image.php
Can we do with
magento\app\code\zendframework1\library\Zend\Captcha\Image.php ?
What will be the class extends?
Following http://webkul.com/blog/overriding-rewriting-classes-magento2/
It's giving 90% answer.
magento\app\code\Zend\Captcha\Image.php
class Zend_Captcha_Image extends Zend_Captcha_Word
{
protected function _generateImage($id, $word)
{
}
}
I want only this function. It gives abstract class error. If i only put this.
Can we override composer.json
for this? Don't want to change in Magento Default
When u click on "Reload Captcha" it gives big DIV blank then it loads. It's not working as default works. Something still missing in override.
Best Answer
The
Magento_Captcha
module useZend_Captcha_Image
for generate of captcha images.Magento\Captcha\Model\DefaultModel:
For extending image generation functionality, you can add you custom preference on
Magento\Captcha\Model\DefaultModel
.di.xml
MyCaptchaModel.php:
Alternatively, you can add plugin on
\Magento\Captcha\Model\CaptchaFactory::create()
and define your custom logic for creating instances of captcha models.