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

AttachmentSizeStatusTest resultOperations
captcha_1.png21.58 KBIgnoredNoneNone

#1

Rob Loach - October 5, 2007 - 15:21
Status:active» reviewed & tested by the community

It seems alright with me.

#2

soxofaan - October 5, 2007 - 15:51

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

Hyunwoo - October 6, 2007 - 15:49

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...

AttachmentSizeStatusTest resultOperations
captcha_2.png24.35 KBIgnoredNoneNone

#4

Rob Loach - October 9, 2007 - 15:35
Status:reviewed & tested by the community» needs review

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?

AttachmentSizeStatusTest resultOperations
image_captcha.module.character_spacing.patch1.78 KBIgnoredNoneNone

#5

Rob Loach - October 9, 2007 - 16:03

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.

AttachmentSizeStatusTest resultOperations
image_captcha.module.character_spacing_2.patch1.48 KBIgnoredNoneNone

#6

soxofaan - October 10, 2007 - 10:02

I reworked the patch from #5 a bit, mainly UI layout/structure tweaks:

  • moved the character spacing from distortion settings to font settings
  • put font settings (font file, size and spacing) in a "Font settings" fieldset
  • put code settings (character set and code length) in "Code settings" fieldset
AttachmentSizeStatusTest resultOperations
image_captcha_character_spacing_3.patch3.72 KBIgnoredNoneNone

#7

Rob Loach - October 10, 2007 - 16:39
Title:too small image for large font(like korean font).» Too small image for large fonts (like Korean)
Status:needs review» fixed

Nice one! I like having everything in fieldsets.

#8

Anonymous - October 24, 2007 - 16:41
Status:fixed» closed
 
 

Drupal is a registered trademark of Dries Buytaert.