Too small image for large fonts (like Korean)
Hyunwoo - October 5, 2007 - 14:45
| Project: | CAPTCHA |
| Version: | 5.x-3.0-rc3 |
| Component: | Image Captcha (image_captcha) |
| Category: | task |
| Priority: | normal |
| Assigned: | Unassigned |
| Status: | closed |
Description
image width is too small to display large font like korean.
so, I just increased the width of image. and, this looks quite good in english character.
diff -ur captcha/image_captcha/image_captcha.module captcha.fix/image_captcha/image_captcha.module
--- captcha/image_captcha/image_captcha.module 2007-08-30 04:18:34.000000000 +0900
+++ captcha.fix/image_captcha/image_captcha.module 2007-10-05 23:40:01.000000000 +0900
@@ -369,7 +369,7 @@
$font_size = (int) variable_get('image_captcha_font_size', 30);
$characters = _image_captcha_utf8_split($code);
$character_quantity = count($characters);
- $width = 1.2 * $font_size * $character_quantity;
+ $width = 1.5 * $font_size * $character_quantity;
$height = 2 * $font_size;
// create image resource| Attachment | Size | Status | Test result | Operations |
|---|---|---|---|---|
| captcha_1.png | 21.58 KB | Ignored | None | None |

#1
It seems alright with me.
#2
does
$width = 1.4 * $font_size * $character_quantity;also work for that font?
I wouldn't make that scale factor too big, because the bigger the images, the more resources you waste to the spammers.
beside that, it's ok for me
#3
some letters(3 characters at 20 image generation) are cut at "1.4" as you can see in attached picture. but, no cut letters in "1.5".
I think admin should select the value in admin menu...
#4
The attached patch will add a "Character spacing" option to the Image Captcha settings screen that will allow you to change this value. Mind reviewing it?
#5
This patch turns the textfield into a combo box. Even though it's not as user friendly, I think I still like the textfield more because you have complete control over the value.
#6
I reworked the patch from #5 a bit, mainly UI layout/structure tweaks:
#7
Nice one! I like having everything in fieldsets.
#8