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

Anyhow, I sure hope that crazy spamming is over!

Published by

Daniel Lemire

A computer science professor at the University of Quebec (TELUQ).

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.


  3. Ido:

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


    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….


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

    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. What exactly did you do to get around the problem with the directory structure? When you go to the URL for my website ( the DOCUMENT_ROOT is /opt/www/dubrawsky_org and captcha doesn’t seem to want to work. I’m interested to know how you got around the problem.

  5. 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.

To create code blocks or other preformatted text, indent by four spaces:

    This will be displayed in a monospaced font. The first four 
    spaces will be stripped off, but all other whitespace
    will be preserved.
    Markdown is turned off in code blocks:
     [This is not a link](

To create not a block, but an inline code span, use backticks:

Here is some inline `code`.

For more help see

You may subscribe to this blog by email.