Can I modify Captcha parameters (height, width, color)?
Posted: 01 March 2007 08:24 AM   [ Ignore ]  
Lab Technician
Avatar
RankRankRankRank
Total Posts:  2124
Joined  03-26-2006

I’m using a captcha on a contact form and it’s kicking out this image file:

<img src="http://www.site.com/images/captchas/1174765150.29.jpg" width="140" height="30" style="border:0;" alt=" " />

Any reason that’s 140x30? I would love to change the height of that (and the color, if possible) but don’t see where I can tweak anything, either through parameters or otherwise. Has anyone ever modified the Captchas?

 Signature 

ryan masuga
—————
Masuga Design (EE Pro) | devot:ee
MD Markitup | All Add-Ons
@masuga | @masugadesign | @devot_ee

Profile
 
 
Posted: 01 March 2007 09:23 AM   [ Ignore ]   [ # 1 ]  
Moderator
Avatar
RankRankRankRankRankRankRank
Total Posts:  29137
Joined  05-15-2004

No particular reason, I should think, but it’s hardcoded in EE. See core.functions.php, around line 1690:

$font_face      = "texb.ttf";
$font_size      = 16;

$expiration = 60*60*2;  // 2 hours

$img_width      = 140;  // Image width
$img_height     = 30;   // Image height

Now, you can either hack that or (preferred), come up with an extension. I think create_captcha_start would be appropriate.

 Signature 

ExpressionEngine 2.0 Downloads | Docs | Bugtracker

“If the English language made any sense, lackadaisical would have something to do with a shortage of flowers.” (Doug Larson)

Profile
MSG
 
 
Posted: 01 March 2007 09:27 AM   [ Ignore ]   [ # 2 ]  
Administrator
Avatar
RankRankRankRankRankRankRankRank
Total Posts:  40192
Joined  05-14-2004

You might also look through the DevBlog entries for the Advanced Captcha extension, which has more options as well as showing how you might modify captchas without hacking. =)

 Signature 
Profile
MSG
 
 
Posted: 01 March 2007 09:36 AM   [ Ignore ]   [ # 3 ]  
Lab Technician
Avatar
RankRankRankRank
Total Posts:  2124
Joined  03-26-2006

I definitely do not want to hack anything. I also haven’t written an extension yet - this might be a good exercise.

Thank you for pointing that out, Ingmar!

Thanks Lisa, I’ll look around for that, and/or try writing my first extension.

 Signature 

ryan masuga
—————
Masuga Design (EE Pro) | devot:ee
MD Markitup | All Add-Ons
@masuga | @masugadesign | @devot_ee

Profile
 
 
Posted: 01 March 2007 10:29 AM   [ Ignore ]   [ # 4 ]  
Lab Assistant
Avatar
RankRank
Total Posts:  147
Joined  10-21-2005

The specific blog entry is here:

http://www.pmachine.com/developers/blog/1663/

 Signature 

1.6.4 | 20080829 | business | pleasure

Profile
 
 
Posted: 01 March 2007 10:42 AM   [ Ignore ]   [ # 5 ]  
Lab Technician
Avatar
RankRankRankRank
Total Posts:  2124
Joined  03-26-2006

Found, downloaded, installed, tweaked just a little to my taste (width/height modifications), and working fine.

Thanks - I didn’t know Advanced Captcha existed, but it’s great!

 Signature 

ryan masuga
—————
Masuga Design (EE Pro) | devot:ee
MD Markitup | All Add-Ons
@masuga | @masugadesign | @devot_ee

Profile
 
 
Posted: 01 March 2007 10:44 AM   [ Ignore ]   [ # 6 ]  
Administrator
Avatar
RankRankRankRankRankRankRankRank
Total Posts:  40192
Joined  05-14-2004

Thanks, TechWench! I’ve been flat out here, sorry about not including the link.  Glad you got it working, Ryan! =)

 Signature 
Profile
MSG
 
 
Posted: 18 April 2007 09:18 AM   [ Ignore ]   [ # 7 ]  
Lab Assistant
RankRank
Total Posts:  213
Joined  10-21-2004

http://www.pmachine.com/developers/blog/1663/

Doesn’t exist anymore. I can’t find it on ellislab or expressionengine.com. Anyone know where the article went to?

Profile
 
 
Posted: 18 April 2007 09:22 AM   [ Ignore ]   [ # 8 ]  
Administrator
Avatar
RankRankRankRankRankRankRankRank
Total Posts:  40192
Joined  05-14-2004

See here =)

 Signature 
Profile
MSG
 
 
Posted: 18 April 2007 12:29 PM   [ Ignore ]   [ # 9 ]  
Administrator
Avatar
RankRankRankRankRankRank
Total Posts:  7337
Joined  03-23-2006

For completeness, the link to the actual add-on page is http://expressionengine.com/downloads/details/advanced_captcha/

 Signature 

DerekAllard.com - CodeIgniter, ExpressionEngine, and the World of Web Design
BambooInvoice - Open Source, CodeIgniter powered invoicing.

Profile
MSG
 
 
Posted: 21 May 2009 01:56 PM   [ Ignore ]   [ # 10 ]  
Lab Assistant
Avatar
RankRank
Total Posts:  113
Joined  05-25-2006

Is this extension still relevant to the latest EE?

 Signature 


Brandon Neil Richards
http://www.brandrichmedia.com/
——————————————————————

Profile
 
 
Posted: 21 May 2009 02:00 PM   [ Ignore ]   [ # 11 ]  
Moderator
Avatar
RankRankRankRankRankRankRank
Total Posts:  29137
Joined  05-15-2004

It should still work, and, yes, it still modifies the original CAPTCHA that EE creates.

 Signature 

ExpressionEngine 2.0 Downloads | Docs | Bugtracker

“If the English language made any sense, lackadaisical would have something to do with a shortage of flowers.” (Doug Larson)

Profile
MSG
 
 
Posted: 21 May 2009 02:17 PM   [ Ignore ]   [ # 12 ]  
Lab Assistant
Avatar
RankRank
Total Posts:  113
Joined  05-25-2006

Thanks for the response, So is there a way to modify the colors? All I really want is to modify the color of the original captcha to something other than the red.

 Signature 


Brandon Neil Richards
http://www.brandrichmedia.com/
——————————————————————

Profile
 
 
Posted: 21 May 2009 02:23 PM   [ Ignore ]   [ # 13 ]  
Moderator
Avatar
RankRankRankRankRankRankRank
Total Posts:  29137
Joined  05-15-2004

I’ll have to give you the same advice I gave Ryan back then: hack EE, or come up with an extension. If the former is an option for you, take a look at core.functions.php, line 1835 and following:

$bg_color$bg_color   = ImageColorAllocate($im, 255, 255, 255);
$border_color        = ImageColorAllocate($im, 153, 102, 102);
$text_color          = ImageColorAllocate($im, 204, 153, 153);
$grid_color          = imagecolorallocate($im, 255, 182, 182);
$shadow_color        = imagecolorallocate($im, 255, 240, 240);
 Signature 

ExpressionEngine 2.0 Downloads | Docs | Bugtracker

“If the English language made any sense, lackadaisical would have something to do with a shortage of flowers.” (Doug Larson)

Profile
MSG
 
 
Posted: 21 May 2009 02:30 PM   [ Ignore ]   [ # 14 ]  
Lab Assistant
Avatar
RankRank
Total Posts:  113
Joined  05-25-2006

Alright I for some reason thought that the advanced captcha allowed one to do that. Thanks Ingmar, more than helpful!

 Signature 


Brandon Neil Richards
http://www.brandrichmedia.com/
——————————————————————

Profile
 
 
Posted: 21 May 2009 02:33 PM   [ Ignore ]   [ # 15 ]  
Moderator
Avatar
RankRankRankRankRankRankRank
Total Posts:  29137
Joined  05-15-2004

Very good smile Closing this legacy thread now; please don’t hesitate to post again as needed.

 Signature 

ExpressionEngine 2.0 Downloads | Docs | Bugtracker

“If the English language made any sense, lackadaisical would have something to do with a shortage of flowers.” (Doug Larson)

Profile
MSG
 
 
   
 
 
Post Marker Legend
New Topic New posts Hot Topic Hot Topic with new posts New Poll New Poll Moved Topic Moved Topic Sticky Topic Sticky topic
Old Topic No new posts Hot Old Topic Hot Topic with no new posts Old Poll Old Poll Closed Topic Closed Topic Announcement Announcements
Theme
Change Theme
Visitor Statistics
The most visitors ever was 1743, on December 02, 2009 03:47 PM
Total Registered Members: 120195 Total Logged-in Users: 92
Total Topics: 126322 Total Anonymous Users: 46
Total Replies: 664349 Total Guests: 422
Total Posts: 790671    
Members ( View Memberlist )