I discovered this module via visiting a site built with Drupal. They had Captcha on their /contact page.

http://www.debuntu.org/contact

So I set the 3.0 version up on a test server. On our test server, the image shows up MUCH smaller than is on this site, no yellow background, etc... Could you have a quick look at that site and suggest how to arrive at what they have?

Thanks!

Comments

smily’s picture

Priority: Normal » Critical

yes.. the font is very small and impossible to makeout what letters r there in the captcha.

so i uploaded a ttf font to the fonts folder: /modules/captcha/image_captcha/fonts and updated the settings with the new font in the Administer » User management » CAPTCHA » Image CAPTCHA. Now i dont see captcha image .. ( i did clear the cache & cookies and tried .. but no result). if i revert back to the default font .. only then the captcha works.. :(

pls help me solving this problem.

soxofaan’s picture

Priority: Critical » Normal

Concerning the small fonts/images: is that with the built-in font? The built-in font is only there to offer out of the box functionality, it is recommended however to use TTF fonts.

so i uploaded a ttf font to the fonts folder: /modules/captcha/image_captcha/fonts and updated the settings with the new font in the Administer » User management » CAPTCHA » Image CAPTCHA. Now i dont see captcha image .. ( i did clear the cache & cookies and tried .. but no result). if i revert back to the default font .. only then the captcha works.. :(

I guess your PHP GD library has no FreeType Support. see http://drupal.org/node/183608#comment-614940 for more info

i uploaded a ttf font to the fonts folder: /modules/captcha/image_captcha/fonts

It is generally a bad idea to put extra (contributed/third party) modules in the "modules/" directory of your drupal set-up. It is much better to put them in "sites/all/modules/". This will make upgrading your drupal installation much less painfull. Believe me, I made the same mistake too when I started with drupal, I won't do it anymore ;)

mdlueck’s picture

Indeed uploading a ttf font made a VAST improvement already. Thank you very much for that suggestion.

Any thoughts of how the site I mentioned got a yellowish background to the Captcha image?

soxofaan’s picture

The yellowish background is not possible with the current Image CAPTCHA. I guess that site uses an old version of Image CAPTCHA or its predecessor MyCaptcha. The blueish characters on the yellowish background in these versions seemed a limitation to me, and its implementation was messy/not very efficient. That's why I changed it to a white background with multi colored characters in the current image CAPTCHA.

You should ask the admins of that site what they use.

Why do you want exactly that yellow/blue layout?
We might add an palette option to the image CAPTCHA, but that would be more in the line of "light characters on a black background" and "dark characters on a white background".

mdlueck’s picture

Very well, I will stick with what is at least working! ;-)

To me it seemed (the yellow background that is) to set that apart... draws attention to it / make it stick out on the page like a sour thumb. Our theme has white pages... I hope people will not miss it.

So, I will toss it into production next!

soxofaan’s picture

Status: Active » Fixed

if you're not afraid of hacking a module, you can always jump into image_captcha.module and look for

  // background
  $background_color = imagecolorallocate($image, 255, 255, 255);
  imagefilledrectangle($image, 0, 0, $width, $height, $background_color);

(around line 435) and change the color 255, 255, 255 to you preference.

mdlueck’s picture

Thanks for that pointer, I will keep it in mind. I do not care much for hacking... turns into a support nightmare.

Would you consider additional properties for the module and expose such configuration details through the admin interface?

robloach’s picture

Title: Graphic seems small / What did this site use? » Change Image Captcha Colors
Status: Fixed » Active

It would be neat to give the user options to set........

Background Color
All primary colors (white (default), black, yellow, red, blue, etc)

Border Color
None (default)
All primary colors (white, black, red, blue, etc)

Text Color
All primary colors (white black, red, blue, etc)
Random (default)

The defaults would mimic the functionality that's in there right now, however you then would also have the option to reproduce what they are using on http://www.debuntu.org/contact by setting the background to yellow, the border to black, and the text color to purple.

robloach’s picture

What if we made use of the Color module?

soxofaan’s picture

Status: Active » Needs work
StatusFileSize
new6.3 KB

The color module seems to be rather oriented towards themes and not much can be reused by modules.

I already tried an initial implementation of the admin GUI (see patch). It's only GUI stuff, the selected colors are not used in the image generation code.

But I'm not really happy with it: when the image generation will be finished it will be a lot of code for a minor feature and it adds jquery/javascript to the mix. The javascript was a lot of copy/pasting from the color module + minor addaptations.
I think it's not suited for long term maintainability, and we should be careful about this.

I would only do it if the color module could also be used by modules so that we can reuse code instead of copy/pasting.

soxofaan’s picture

Version: 5.x-3.0 » 5.x-3.x-dev

Instead of implementing a colorpicker by our own, it would be better to use http://drupal.org/project/colorpicker

robloach’s picture

We'll have to gracefully degrade to something else if Color Picker isn't enabled. Simple text fields?

soxofaan’s picture

Assigned: Unassigned » soxofaan
StatusFileSize
new5.36 KB

Here is a first simple patch for a reiteration of the concept:
just two hex-color textfields for background and foreground color.

todo: add (optional) randomness to the foreground color

soxofaan’s picture

Status: Needs work » Needs review
StatusFileSize
new29.85 KB
new6.78 KB

follow-up on #13:
added randomness to foreground color

soxofaan’s picture

StatusFileSize
new7.31 KB

in attachment the patch from #14 ported to the 6.x-1.x branch

feature is already committed to HEAD: http://drupal.org/cvs?commit=107556

soxofaan’s picture

from http://drupal.org/node/233873#comment-783556:

back- and foreground (which should imho rather been named text) color

Good point
in attachment the new patches for DRUPAL-5--3 and DRUPAL-6--1
already committed to HEAD by http://drupal.org/cvs?commit=107720

soxofaan’s picture

from http://drupal.org/node/233873#comment-783556:

Another thing, the color randomization does not ensure enough contrast between back- and foreground (which should imho rather been named text) color, I have set background to #000000 and foreground to #008000; with moderate randomization sometimes one character is way to dark (of course my foreground color is but I thought I'd try.. it's kinda more cool then my hack it actually gives a fitting captcha to my theme, see http://hfopi.org/contact) .. and well the double vision color is too near the foreground color too..

Well, if your background and foreground color are too close, you shouldn't set the color randomness too high. One could of course think of more complicated randomness schemes that take the closeness into account, but I assume that most users will take colors far enough from each other, or take low variation otherwise.
In the long term we could also add a fancy javascript color picker and such, but I just wanted to provide a simple but functional solution for this issue.
In further patches additional patches we could add the more advanced stuff if needed/requested.

About the double vision you use in your setup: do you really like that feature? I am consideringt dropping it because it seems very bad for usability, it's hard to explain it to normal human visitors. I've setup pol about it on http://groups.drupal.org/node/10168

soxofaan’s picture

CyberAngel’s picture

Hi!
I have a question. How I doing to apply this patch to the my captcha?
I would change the background image without change the color in the image_captcha.module every time.

Thanks!

soxofaan’s picture

The patch is already committed to CVS, so the feature is in the development snapshot of the module: http://drupal.org/node/158901

If you really want to patch, you can more information at http://drupal.org/patch/apply

Anonymous’s picture

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for two weeks with no activity.