I add fonts into the correct fonts folder (sites/all/modules/captcha/image_captcha/fonts). Captcha admin sees them and offers me a select list. I choose one and submit. In FF I get no image at all, in IE I actually get the red cross broken image icon.

What is the problem here? The path is right. Is it the type of font I'm using. I even uploaded a well-known font such as arial.ttf and still nothing. I have 5 fonts uploaded and get the same issue with all of them.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

soxofaan’s picture

Status: Active » Postponed (maintainer needs more info)

Are there any related error entries in your drupal log (?q=admin/logs/watchdog) ?
I guess your PHP version has GD library (http://be.php.net/gd) support?
what does ?q=admin/logs/status say about GD library?

esllou’s picture

Hi,

there are no errors in the watchdog list. Our PHP version is 5.2.1. There isn't anything about GD library on the Status Report page:

just php version and this:

Unicode library Standard PHP
Operations on Unicode strings are emulated on a best-effort basis. Install the PHP mbstring extension for improved Unicode support.

isn't that something else? I am running a pretty standard 5.2 installation (on a dedicated server, which might mean something is missing).

esllou’s picture

I've read up a little on the GD library and it seems to suggest that if it were missing, I wouldn't have the image captcha working at all, whereas it does seem to be working...only not with the additional tff fonts. It works fine with the default "built in font", just that the letters come out looking very small and I thought about using a custom font to increase them.

soxofaan’s picture

That's weird. You don't have the GD library enabled, but you still can generate images with the built in font?

could you execute the following php on your server, for example by creating a new page with the "PHP code" input format:

if (function_exists('imagegd2')) {
  var_export(gd_info());
}
$fs = array('imagejpeg', 'imagecreatetruecolor', 'imagedestroy',
  'imagecolorallocate', 'imagefilledrectangle', 'imagecolorat', 'imagesetpixel', 
  'imageline', 'imagefontwidth', 'imagettfbbox', 'imagestring', 'imagettftext',
);
foreach($fs as $f) {
  print "$f: ". var_export(function_exists($f), TRUE) .'<br />';
}

and post the result?

soxofaan’s picture

Thats' weird. You don't have the GD library enabled

My mistake, this is probably not true. Apparently the color module needs to be enabled to get GD information listed on the status report. I assumed GD info was listed by default.

esllou’s picture

Here is what I got:

array ( 'GD Version' => 'bundled (2.0.28 compatible)', 'FreeType Support' => false, 'T1Lib Support' => false, 'GIF Read Support' => true, 'GIF Create Support' => true, 'JPG Support' => true, 'PNG Support' => true, 'WBMP Support' => true, 'XPM Support' => true, 'XBM Support' => true, 'JIS-mapped Japanese Font Support' => false, )imagejpeg: true
imagecreatetruecolor: true
imagedestroy: true
imagecolorallocate: true
imagefilledrectangle: true
imagecolorat: true
imagesetpixel: true
imageline: true
imagefontwidth: true
imagettfbbox: false
imagestring: true
imagettftext: false

does that help to explain why I can't use those extra ttf fonts?

soxofaan’s picture

Assigned: Unassigned » soxofaan
Category: support » task
Status: Postponed (maintainer needs more info) » Active

does that help to explain why I can't use those extra ttf fonts?

yep, GD library with "FreeType Support" is required for the image captcha, which is not the case for you:

"'FreeType Support' => false"

I think we need to add a check during module installation to test this.

esllou’s picture

how would I resolve that? do I need to download and install GD library from fresh?

soxofaan’s picture

how would I resolve that? do I need to download and install GD library from fresh?

I'm not very familiar with that. You seem to suggest that you have root access to the server, is that correct? Otherwise you should ask the server admins/support.

soxofaan’s picture

Title: Adding ttf font results in no images being created. » no image CAPTCHA with ttf font: add requirement check for image CAPTCHA
Status: Active » Needs review
FileSize
1.85 KB

This patch adds a requirement check to the image CAPTCHA: GD library needed and GD library must support FreeType. If one of these requirements fails, this results in an error on the status report.

It would be nicer to detect this before installing the image CAPTCHA module, but it seems that this is not possible now (in Drupal 5.3): only runtime checks are possible for contributed modules, for core modules also pre-install checks are possible however.

soxofaan’s picture

FileSize
1.85 KB

sorry, #10 contains the wrong patch
this one should be better

RobLoach’s picture

Title: no image CAPTCHA with ttf font: add requirement check for image CAPTCHA » Add requirement check for GD Library when using Image CAPTCHA
Status: Needs review » Fixed

Working for me!

soxofaan’s picture

It would be nicer to detect this before installing the image CAPTCHA module, but it seems that this is not possible now (in Drupal 5.3): only runtime checks are possible for contributed modules, for core modules also pre-install checks are possible however.

For those interested in this issue, I made a bug report out of this: http://drupal.org/node/189312

Anonymous’s picture

Status: Fixed » Closed (fixed)

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