Looking for someone to help me to determine why I'm not able to see any images on any activated forms such as user registration when activating image_captcha module?

The form does prompt one to enter displayed text but the image is not seen.

I've tried on Firefox 2.0.0.6 and Safari 2.0.4 without much success.

Thanks.

Comments

soxofaan’s picture

Do the other captcha types (math, text) work (show to untrusted users, block on wrong answer, submit on right answer)?
Does your setup involves proxies or other web page caching mechanisms?
Try commenting line 207 (or close to 2007) of image_captcha.module:

    // drupal_set_header("Cache-Control: max-age=3600, must-revalidate");
mike15’s picture

Do the other captcha types (math, text) work (show to untrusted users, block on wrong answer, submit on right answer)?

I've tried enabling math & text for user_reg and I see the following questions so it appears to be working although I didn't verified if it accepts my answers.

Math Question: What is 1 + 1?: *
What is the second word in the captcha phrase "vebufas simuwi vadu fugo oqoje"?: *

Does your setup involves proxies or other web page caching mechanisms?

Yes, I am utilizing eAccelerator:

PHP 5.2.1 (cli) (built: Apr 1 2007 15:20:56)
Copyright (c) 1997-2007 The PHP Group
Zend Engine v2.2.0, Copyright (c) 1998-2007 Zend Technologies
with eAccelerator v0.9.5.1, Copyright (c) 2004-2006 eAccelerator, by eAccelerator

Try commenting line 207

I've tried disabling the line recommended but don't see any images other then a captcha field asking to enter the phrase from the image.

soxofaan’s picture

"Try commenting line 207

I've tried disabling the line recommended but don't see any images other then a captcha field asking to enter the phrase from the image.

also comment line 196:
// unset($_SESSION['image_captcha']);

The thing is that the image can only be generate once (to prevent misuse and pollution of the session variables). With line 196 commented, the image can be generated multiple times (and there shouldn't be any caching/proxy problems). The distortions in the captcha image will actually be different every time, only the depicted code will be the same.
Also dive into the html of the challenge and try to get the url of the image. Can you see an image if you paste that url in your browser?

mike15’s picture

Hmm, I disable the line 196 still no luck seeing any images on the page.

The url of image appears to be pointing @http://www.domain.com/image_captcha/2002202705. Even if you try accessing this URL, I get a blank screen.

I've also tried looking at the web server logs which appear to be ok:

Using Firefox:
192.168.10.1 - - [02/Aug/2007:18:40:31 -0400] "GET /image_captcha/2002202705 HTTP/1.1" 200 - "-" "Mozilla/5.0 (Macintosh; U; Mac; en-US; rv:1.8.1.6) Gecko/20070725 Firefox/2.0.0.6"

Using Safari:
192.168.10.1 - - [02/Aug/2007:18:42:21 -0400] "GET /image_captcha/2002202705 HTTP/1.1" 200 - "-" "Mozilla/5.0 (Macintosh; U; Mac; en) AppleWebKit/419.2.1 (KHTML, like Gecko) Safari/419.3"

soxofaan’s picture

Even if you try accessing this URL, I get a blank screen.

Is it a blank screen or do you get a pale yellow image without text? If so, the image captcha can't find the ttf font. Did you change settings in the image captcha configuration page? Try to save these settings at least once (you don't need to change something), do you then get an error message that the font can't be found? Also check if there are any fonts in the fonts subdirectory of the image captcha modue.

I've also tried looking at the web server logs which appear to be ok:

No error messages whatsoever? Is error reporting disabled or something? Without error messages it is difficult to guess what's wrong.

Does the mycaptcha module (http://heine.familiedeelstra.com/mycaptcha-download) work? The image captcha of the rewritten captcha module is based on that. Disable all captcha modules first before enabling mycaptcha.

Does the textimage module (http://drupal.org/project/textimage) work? Just try the text->image functionality, not the captcha of that module (it won't work anymore probably).

heine’s picture

Your PHP interpreter needs to be compiled with support for the FreeType library.

Check whether phpinfo lists the following entries under GD:

FreeType Support 	enabled 
FreeType Linkage 	with freetype

To view phpinfo, make a file (eg info.php) with the code below then visit it (http://example.com/info.php).

  phpinfo();
mike15’s picture

I have checked my php.ini and it didn't appear that PHP was compiled with FreeType fonts. So I've recompiled the PHP and included the '--with-freetype-dir=/usr/local/lib' without any issues.

I've checked the GD section after compiling the PHP and I still don't necessarily see any references to FreeType:

GD Support enabled
GD Version 2.0 or higher
GIF Read Support enabled
GIF Create Support enabled
JPG Support enabled
PNG Support enabled
WBMP Support enabled

Also, looking at the web server logs, seeing some php errors:

[Tue Aug 07 15:07:10 2007] [error] [client 10.10.1.1] PHP Fatal error: Call to undefined function imagettfbbox() in /webroot/modules/captcha/image_captcha/image_captcha.module on line 361, referer: http://www.site.com/user/register

pmc2000’s picture

I was having the same problem as you described. No images being created for image captcha.

I used a previous php build and had forgotten to run 'make clean' before rebuilding with freetype. Now image captcha is working fine.

mike15’s picture

Status: Active » Fixed

I want to thank everyone who help me resolve this issue. The 'make clean' is what got me this time around. As previously noted, my PHP was not compiled with FreeType and GD was not aware of FreeType fonts to use.

I recompile PHP with the following settings:

'--with-freetype-dir=/usr/local/lib'
'--with-gd'
'--enable-gd-native-tt'

After you compile, I now have the following under GD:

GD Support enabled
GD Version bundled (2.0.28 compatible)
FreeType Support enabled
FreeType Linkage with freetype
FreeType Version 2.3.5

Thanks, again!

Anonymous’s picture

Status: Fixed » Closed (fixed)
prasannah.ganeshan’s picture

It was a very useful comment. I was able to reconfigure my server with GD and now it's working.

jerinpd’s picture

Version: 5.x-3.x-dev » 6.x-1.x-dev
soxofaan’s picture

at jerinpd in #12:

Please do not change the version flag of this thread, without giving more information why you want to change it

Moreover, CAPTCHA 6.x-1.x is unsupported, use the CAPTCHA 6.x-2.x branch for Drupal 6

mrfreshly’s picture

I had this issue pop up recently. After poking around and debugging for a while, I discovered Clean-URLs was disabled for the particular site that was throwing blank/broken image_captcha images. This resulted in the $_GET['sid'] param not getting through.

instead of:
/image_captcha?sid=161&ts=1435533445
it was doing:
/?q=image_captcha&sid=161&ts=1435533445

I'm not sure why it's not properly dealing with the url_encoded string, didn't really look any deeper...But, just enabling Clean-URLs put the sid as the first parameter and made it happy enough to work...(I don't think ts is really used by captcha)

sydneyjane’s picture

Issue summary: View changes

Thanks, #14 worked for me (on Drupal 7.x).