Comments are back! But you need to pass a reverse Turing test!

I’ve installed Boriel’s Capcha! Plugin in my copy of wordpress. “Captcha” is the acronym for completely automated public Turing test to tell computers and humans apart (see wikipedia entry). It worked well so far, but I had two issues during the installation:

  • The “TMP Folder” where images are stored must be inside a “www” directory otherwise, a broken link will appear instead of the image. The plugin assumes that your web site is served from the directory /something/www/… This was not my case, but I was able to fix the problem using a symbolic link (command ln).
  • The “TrueType Folder” option must end with a slash “/” otherwise you will be told that fonts cannot be found.

Why use Boriel’s plugin? I tried two others, Secureimage and Bot Check. At least Secureimage had the issue that the captcha images would not contain any text. After some investigation, it turns out that the problem is that it uses the ImageMagick library assuming FreeType support: my server has ImageMagick but without FreeType support so it cannot do text annotations.

If you want to see whether this is a problem for you try to annotate an image using either the convert or mogrify command line utilities. You can recognize the problem by trying the following test:

$ mogrify someimage.jpg -draw
'text 0,0 tata' someimage.jpg

mogrify: FreeTypeLibraryIsNotAvailable
(/usr/local/share/ghostscript/fonts/n0190
03l.pfb).

Anyhow, I sure hope that crazy spamming is over!

6 thoughts on “Comments are back! But you need to pass a reverse Turing test!”

  1. Nice to see you’re using captcha! šŸ™‚

    Thanks for your suggestions.
    I didn’t want to change the original hn_captcha class. That’s why I used tmp and ttf folders that way. But you’re right:

    Some other people have told me about TTF slash and tmp directory.

    TTF Folder can be (not tested, but should work) in any directory readable by Apache/PHP, but TMP directory must be inside the apache published directories, because the image is served as a jpg. šŸ˜•

    I was thinking of showing the image “on the fly” with a php script, so the TMP could be anywhere in the filesystem (and not into the www) or even not necessary at all.

    If you’re interested, I will tell you, and again, Thanks. šŸ™‚

  2. I ran into the same problem with ImageMagick, and installed this instead. Nice. Works cleanly. Agree that it would be better if I could use a system TMP directory rather than a WWW accessible one.

    Thomas

  3. Ido:

    You have to insure your directory structure lies inside a www directory. To get this result, say your web directory is…

    /something/HTTP/…

    then do

    ln -s /something/HTTP /something/www

    In your case, your problem seems more complex… for example, it tells me the image is at….

    /opt/www/dubrawsky_org/tmp/hn_captcha_075efa.jpg

    But I’ve tried the following URLs and can’t find it…

    http://www.dubrawsky.org/tmp/hn_captcha_075efa.jpg

    http://www.dubrawsky.org/dubrawsky_org/tmp/hn_captcha_075efa.jpg

    So, I’m not sure what you are saying when you say that the “the DOCUMENT_ROOT is /opt/www/dubrawsky_org”, if so, the first URL should work. Have you set permissions right?

  4. I found the problem. For reasons I don’t know the gd library didn’t get compiled with jpeg support. I actually had to recompile the jpeg library first (it didn’t include the set_jpeg_defaults() function call for some reason), then the gd library, then PHP and re-install PHP and now everything works great. Thanks for the help!

Leave a Reply

Your email address will not be published. Required fields are marked *