logo
Published on Technical articles on: Windows servers, Apache Web Server, MySQL, PHP, IIS (http://www.sitebuddy.com)

Changing captcha fonts and font sizes

By chris
Created 11 Jan 2006 - 10:45pm

Update 08_14_2006: To change the number of character in the image from 4 to 6 to 3 to 4. Make the following change inside the file in the textimage.module.

function _textimage_code() {
    $string = drupal_substr($string,0,rand(4,6));  { THIS IS THE LINE TO MODIFY!
    $string = drupal_substr($string,0,rand(3,4));
-------------------------------------------------- Create the directory d:\wwwroot\drupal\fonts and copied the file arialbd.ttf to the new directory (you need the IIS_USER/Or_Apache_Server_User read permissions on this folder). On the "captcha settings" screen in Drupal at 'True Type Fonts Path' set to d:\wwwroot\drupal\fonts

To change the font size, edit the value of the variable $charSize in the _captcha_image() function in captcha.module. You have to modify the image size and the initial value of $y as well. My settings for a 48pt font are:
$im = imagecreatetruecolor(320, 160);
$charSize = 48;
$y = 60;

Ref: http://drupal.org/node/24556

Source URL:
http://www.sitebuddy.com/Drupal/Module/captcha