I didn't see what php extension I need to make sure are working for the image captcha. Can someone point me in the right direction?

Also, I notice that the broken images are pointing to image_captcha directory in the root of my site. Shouldn't it point to the one in the module folder?

Comments

Nikkol’s picture

this may be part of the problem .... error in logs ...

Table 'drupal.captcha_points' doesn't exist query: SELECT module, type FROM captcha_points WHERE form_id = 'search_block_form' in E:\drupal-5.2\includes\database.mysql.inc on line 172.

soxofaan’s picture

I didn't see what php extension I need to make sure are working for the image captcha. Can someone point me in the right direction?

You need the GD library (which is typically enabled in a default PHP install as far as I know). see http://php.net/manual/en/ref.image.php

Also, I notice that the broken images are pointing to image_captcha directory in the root of my site. Shouldn't it point to the one in the module folder?

"image_captcha" is not a real file system path, it is a so called "drupal path". Just like the drupal paths "node/10" and "admin/settings" e.g. It is all right.

Table 'drupal.captcha_points' doesn't exist query: SELECT module, type FROM captcha_points WHERE form_id = 'search_block_form' in E:\drupal-5.2\includes\database.mysql.inc on line 172.

I guess you upgraded from a previous version of captcha. Is that right? Did you run the update.php script?

robloach’s picture

Does Clean URLs have to be on in order to use Image Captcha? If so, should we implement clean URL support into the module?

soxofaan’s picture

Status: Active » Postponed (maintainer needs more info)

Does Clean URLs have to be on in order to use Image Captcha? If so, should we implement clean URL support into the module?

I don't see any point in "supporting" clean URLs,. They are provided by Drupal transparently (by using the l() function). I don't think any module has to "do"/"know" something in order to "use" clean URLs. The image CAPTCHA just uses standard Drupal links/paths/urls, so I don't see a problem.

robloach’s picture

Yup, works without Clean URLs enabled:

'#value' => '<img src="'. check_url(url("image_captcha/$seed")) .'" />',

Did you find the problem, Nikkol?

Nikkol’s picture

not yet, but I think that it may be a clean url problem. I'm on IIS using ISAPI rewrite. I'll do more troubleshooting and see what I come up with.

Nikkol’s picture

it appears to be something with my php/gd install. I ran a simple gd test script and get a broken image that way too. I'm in the process of setting up a new server, so I think I'll put this on hold and hope a brand new install of php will work.

wilei’s picture

I had this problem too, and I found out that reason for this problem is incomplete path to used font. With rc1 all works fine, because in its image captcha configuration you should type full path to font -file, but in rc3/dev you have just dropdown list of "installed" fonts. And with that path is incomplete.

For now I fixed it with just adding this line
$font="/full/path/to/your/drupal/installation/".$font;
just after lines with
list($font, $errmsg) = _image_captcha_get_font();
in functions _image_captcha_generate_image() and image_captcha_captcha()

Without full path to file, PHP tries to find font from library-defined font path. See: http://fi.php.net/imagettfbbox and that's why full path to font file is needed.

soxofaan’s picture

StatusFileSize
new830 bytes

at #8:
does this patch also solves your issue?
(I can't reproduce your problem because I have a different PHP/GD version probably)

wilei’s picture

at #9:

Patch fixes problem with rc3. But personally I don't like usage of realpath like this :) I think that "basepath" of any drupal/etc. installation is some of most critical things to define or check when handling files and it should be done by some other way than using realpath places like in patch...

soxofaan’s picture

at #10:
I don't understand your problem with realpath. We just need the the full absolute path of a given relative path and realpath delivers that as far as I know. If you know a better function, please make it known.

soxofaan’s picture

Title: images don't display » images don't display, font problem?
Status: Postponed (maintainer needs more info) » Needs review

I've looked in Drupal core, and the function realpath() is used in includes/file.inc a couple of times.
I still don't understand the problem of #10

robloach’s picture

StatusFileSize
new1.39 KB

I think he's worried about storing the absolute path, used when using realpath(), inside the database. We should have it use the path relative to the Drupal root directory so that if you move the Drupal folder, you don't run into Captcha problems when it looks for the font in a none existent directory.

Does this patch help? Instead of passing the relative path to the GD functions, it passes the realpath of the font, only if it's not the built in one.

soxofaan’s picture

Status: Needs review » Reviewed & tested by the community

patch from #13 is indeed better

soxofaan’s picture

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

Status: Fixed » Closed (fixed)