We can't package TTF fonts with the image_captcha module, but the PHP image library has some simple bitmap fonts built in.
This patch makes the image_captcha module to use a built-in font as default.
This approach is more user friendly, because the image_captcha module now works out of the box. A warning is issued however that the built in font is not recommended because of its small size.

Comments

robloach’s picture

Status: Needs review » Needs work

This patch wasn't working for me.... Didn't render anything, either in the settings page, or the examples page.

soxofaan’s picture

hmm,
any error messages/warnings? also check watchdog log

robloach’s picture

Location: http://localhost/drupal-5.2/?q=image_captcha/604762361
Referrer: http://localhost/drupal-5.2/?q=admin/user/captcha/captcha/examples
Message: Could not find or read the configured font "" for the image captcha.
Severity: error

.... When visiting the examples page.

robloach’s picture

I had a look at the source and it seems it defaults $font to 'BUILTIN'. What if an empty $font also represents the built in font?

soxofaan’s picture

StatusFileSize
new8.55 KB

what about this patch?
difference with previous patch: I just changed

    $font = FALSE;
    $errmsg = t('Could not find or read the configured font "%font" for the image captcha.', array('%font' => $font));

to

    $errmsg = t('Could not find or read the configured font "%font" for the image captcha.', array('%font' => $font));
    $font = FALSE;

So that the error message makes more sense ;)

soxofaan’s picture

Status: Needs work » Needs review
robloach’s picture

StatusFileSize
new4.16 KB

Hrmmm, a couple sections were rejected. Might need a rebuild...

soxofaan’s picture

StatusFileSize
new8.6 KB

new version of patch (against image_captch.module v 1.1.4.19)

robloach’s picture

Priority: Normal » Critical
Status: Needs review » Reviewed & tested by the community

Tested on a Windows machine and it works.

soxofaan’s picture

Any idea why it didn't work for you in #1?
nothing special changed compared with the original patch as far as I know.

robloach’s picture

Really not sure, might've been a variable setting I had, not sure.

robloach’s picture

Status: Reviewed & tested by the community » Fixed
Anonymous’s picture

Status: Fixed » Closed (fixed)