Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Captcha font issue #60

Open
zabimca opened this issue Apr 12, 2019 · 8 comments
Open

Captcha font issue #60

zabimca opened this issue Apr 12, 2019 · 8 comments

Comments

@zabimca
Copy link

zabimca commented Apr 12, 2019

Hi,
I'm getting warning error in Reset Password page and couldnt able to reset password.

Warning: imageftbbox(): Could not find/open font in C:\xampp\htdocs\userdemo\vendor\zendframework\zend-captcha\src\Image.php on line 510

Warning: imagefttext(): Could not find/open font in C:\xampp\htdocs\userdemo\vendor\zendframework\zend-captcha\src\Image.php on line 513
reset_password

Screenshot attached for reference. Please help me on that

@kristofermagic
Copy link

make sure you have created the folder: captcha: public/img/captcha
and the folder font inside data: AppName/data/font/thorne_shade.ttf

then: setup the captcha form element inside the PasswordResetForm.php
...
..
'captcha' => [
'class' => 'Image',
'imgDir' => 'public/img/captcha',
'suffix' => '.png',
'imgUrl' => 'img/captcha/',
'imgAlt' => 'CAPTCHA Image',
'font' => './data/font/thorne_shaded.ttf',
..
..
..

I resolved this problem with the after-mentioned. Good Luck.

@zabimca
Copy link
Author

zabimca commented Apr 15, 2019

make sure you have created the folder: captcha: public/img/captcha
and the folder font inside data: AppName/data/font/thorne_shade.ttf

then: setup the captcha form element inside the PasswordResetForm.php
...
..
'captcha' => [
'class' => 'Image',
'imgDir' => 'public/img/captcha',
'suffix' => '.png',
'imgUrl' => 'img/captcha/',
'imgAlt' => 'CAPTCHA Image',
'font' => './data/font/thorne_shaded.ttf',
..
..
..

I resolved this problem with the after-mentioned. Good Luck.

Above mentioned code is already there in my code. No Luck.

@kristofermagic
Copy link

have you active the GD php extension?

@zabimca
Copy link
Author

zabimca commented Apr 17, 2019

have you active the GD php extension?

Yes it is active.

@JimTzoy
Copy link

JimTzoy commented Sep 14, 2019

hola alguien ya soluciono este error es que no puedo pasar de este error igual tengo activa la extensión gd y el archivo PasswordResetForm.php esta igual. por favor soy nuevo en esto

@heldersoares
Copy link

I was struggling also with this in Windows. I found out that the 'font' key should be made with realpath() (I believe is an issue with the imagefbbox function). Also, as I did not setup VirtualHost, I had to add './' in the 'imgDir' key

$this->add([
'type' => 'captcha',
'name' => 'captcha',
'options' => [
'label' => 'Human check',
'captcha' => [
'class' => 'Image',
'imgDir' => './public/img/captcha', //added ./
'suffix' => '.png',
'imgUrl' => 'img/captcha/',
'imgAlt' => 'CAPTCHA Image',
'font' => realpath('./data/font/thorne_shaded.ttf'), //added realpath
'fsize' => 24,
'width' => 350,
'height' => 100,
'expiration' => 600,
'dotNoiseLevel' => 40,
'lineNoiseLevel' => 3
],
],
]);

Hope this helps!

@JimTzoy
Copy link

JimTzoy commented Nov 29, 2019

@heldersoares

thank you friend, excellent contribution it worked correctly

@heldersoares
Copy link

:)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants