Post by aerogel » Tue Jun 26, 2018 2:02 am

hi
is there a way to change the generated captha font?
tnx

New member

Posts

Joined
Thu Jan 04, 2018 8:14 pm

Post by rjcalifornia » Tue Jun 26, 2018 9:35 am

sedra wrote:
Tue Jun 26, 2018 2:02 am
hi
is there a way to change the generated captha font?
tnx
Depends of the plugin. If you are using Google captcha, you might want to start here:

https://developers.google.com/recaptcha ... tomization

Image
A2 Hosting features: Shared Turbo Boost, Managed Warp 1, Unmanaged Hyper 1, and Warp 2 Turbo


Active Member

Posts

Joined
Fri Sep 02, 2011 1:19 pm
Location - Worldwide

Post by paulfeakins » Tue Jun 26, 2018 5:01 pm

sedra wrote:
Tue Jun 26, 2018 2:02 am
is there a way to change the generated captha font?
Why?

UK OpenCart Hosting | OpenCart Audits | OpenCart Support - please email info@antropy.co.uk


User avatar
Legendary Member
Online

Posts

Joined
Mon Aug 22, 2011 11:01 pm
Location - London Gatwick, United Kingdom

Post by aerogel » Thu Jun 28, 2018 2:08 am

im using the built in basic captcha and honestly it is hard to read and i prefer more stylish font.

New member

Posts

Joined
Thu Jan 04, 2018 8:14 pm

Post by straightlight » Thu Jun 28, 2018 2:11 am

In this case, it would rather be suggested to look for extensions on the Marketplace that already provides better presentations for Captcha to save you the trouble. Otherwise, you'd still need to modify each CSS files according to each themes you might be currently using.

Dedication and passion goes to those who are able to push and merge a project.

Regards,
Straightlight
Programmer / Opencart Tester


Legendary Member

Posts

Joined
Mon Nov 14, 2011 11:38 pm
Location - Canada, ON

Post by aerogel » Thu Jun 28, 2018 2:14 am

i guess a php function generates the captcha image. maybe there is an option for changing the default font for the function? i dont like to add other extensions or modules or addons whatsoever to keep things more simple and easy to manage and easy to restore.

New member

Posts

Joined
Thu Jan 04, 2018 8:14 pm

Post by straightlight » Thu Jun 28, 2018 2:28 am

sedra wrote:
Thu Jun 28, 2018 2:14 am
i guess a php function generates the captcha image. maybe there is an option for changing the default font for the function? i dont like to add other extensions or modules or addons whatsoever to keep things more simple and easy to manage and easy to restore.
The Basic Captcha uses GD Library to form the algorithm from catalog/controller/extension/captcha/basic.php file. This is where you'd need to make the modifications to suit your needs.

Dedication and passion goes to those who are able to push and merge a project.

Regards,
Straightlight
Programmer / Opencart Tester


Legendary Member

Posts

Joined
Mon Nov 14, 2011 11:38 pm
Location - Canada, ON

Post by aerogel » Fri Jun 29, 2018 5:43 am

after 8 hours of digging internet and tinkering, this is how you can change basic captcha font:
download a free and good looking true type font and rename it to a random complex name for being nearly impossible to guess.
put the font in image folder.
go to the catalog/controller/extension/captcha and open basic.php for editing.
comment out this line:

Code: Select all

imagestring($image, 10, intval(($width - (strlen($this->session->data['captcha']) * 9)) / 2), intval(($height - 15) / 2), $this->session->data['captcha'], $black);
at line number 48 and add this one:

Code: Select all

$font = './image/YourComplexFontName.ttf';
//you can use this as a guide
imagettftext($finalimage,fontsize,angle,lowerleftX,lowerleftY,fontcolor,fontpath,captchatext);
imagettftext($image, 20, 0, intval(($width - (strlen($this->session->data['captcha']) * 9)) / 2) - 20, 35 - intval(($height - 15) / 2), $black, $font , $this->session->data['captcha']);
you can fine tune the position of the captcha according to your font using lowerleftX and lowerleftY variables (as i have done above).
i also recommend to change the image type to PNG for clearer result. it means you need to change header type in next lines to:

Code: Select all

header('Content-type: image/png');
imagepng($image);
done!
repeat the above procedure for the admin captcha through this address admin/controller/common/base.php.
now the captcha is more secure and looks more professional!(i guess :D)
Last edited by aerogel on Tue Aug 20, 2019 9:25 pm, edited 4 times in total.

New member

Posts

Joined
Thu Jan 04, 2018 8:14 pm

Post by karadev » Mon Jul 29, 2019 2:37 pm

Hello friend, I did this example and it works great :) I recommend you insert into the default install base in opencart for all versions. I use the font ARIAL.ttf is great for users and you can see normal text in captcha.

I have a question about you. how can i control characters that show in captcha and i need to write so that users can pass CAPTCHA !!!

Example use for me is someone like this to tell the script what symbols to use:
symbols_using_captcha = a-z, A-Z, 0-9;
i do not know how to encode it but i see it can do it :)
and the second question is about this line in your code:
// imagettftext ($ finalimage, FONTSIZE, angle, lowerleftX, lowerleftY, FONTCOLOR, FontPath, captchatext)
how to use these settings? and can you give an example of one or two or all settings :)

Thanks in further and best regards for you and poeple like you in this system :)

http://www.karadev.net
http://www.webshop.karadev.net


User avatar
New member

Posts

Joined
Mon Nov 29, 2010 9:31 pm
Location - Varna, Bulgaria

Post by letxobnav » Mon Jul 29, 2019 2:54 pm

now the captcha is more secure and looks more professional!(i guess :D)
More secure, no, more professional, hardly.
I recommend you insert into the default install base in opencart for all versions. I use the font ARIAL.ttf is great for users and you can see normal text in captcha.
I don't as the basic concept of a captcha is that it is supposed to be difficult to read, that is the whole point.

Crystal Light Centrum Taiwan
Extensions: MailQueue | SUKHR | VBoces

“Data security is paramount at [...], and we are committed to protecting the privacy of anyone who is associated with our [...]. We’ve made a lot of improvements and will continue to make them.”
When you know your life savings are gone.


User avatar
Expert Member

Posts

Joined
Fri Aug 18, 2017 4:35 pm
Location - Taiwan

Post by karadev » Mon Jul 29, 2019 3:13 pm

dude, i know what is the whole point. i am asking you for explane settings of comment line and give some example for that. in before lines in my message i just want to explane to you what i make with your example. that is all

give some example for this line here //imagettftext($finalimage,fontsize,angle,lowerleftX,lowerleftY,fontcolor,fontpath,captchatext)
all point i know what is

http://www.karadev.net
http://www.webshop.karadev.net


User avatar
New member

Posts

Joined
Mon Nov 29, 2010 9:31 pm
Location - Varna, Bulgaria

Post by letxobnav » Mon Jul 29, 2019 4:16 pm

you lost me at "dude".

Crystal Light Centrum Taiwan
Extensions: MailQueue | SUKHR | VBoces

“Data security is paramount at [...], and we are committed to protecting the privacy of anyone who is associated with our [...]. We’ve made a lot of improvements and will continue to make them.”
When you know your life savings are gone.


User avatar
Expert Member

Posts

Joined
Fri Aug 18, 2017 4:35 pm
Location - Taiwan

User avatar
Legendary Member
Online

Posts

Joined
Mon Aug 22, 2011 11:01 pm
Location - London Gatwick, United Kingdom
Who is online

Users browsing this forum: No registered users and 14 guests