Need to override method getImgUrl()
from vendor\magento\module-captcha\Helper\Data.php but not success
app/code/YourCompany/YourModule/etc/di.xml
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:ObjectManager/etc/config.xsd">
<preference for="Magento\Captcha\Helper\Data" type="YourCompany\YourModule\Helper\Data" />
Override helper method code
namespace YourCompany\YourModule\Helper;
class Data extends \Magento\Captcha\Helper\Data
{
public function __construct() {
echo "Helper Rewrite Working"; die() // working till here
}
public function getImgUrl($website = null)
{
return $this->_storeManager->getStore()->getBaseUrl(
DirectoryList::MEDIA
) . 'testhelper' . '/' . $this->_getWebsiteCode(
$website
) . '/';
}
}
// working till here
? when you use die() the remaining codes will not be executed