[Looking for Charlie's main web site?]

Simplifying the captcha graphic in Lyla Captcha (and BlogCFC)

Wish you could simplify your captcha's? If you use Peter Farrell's Lyla Captcha, as I do because it's embedded in Ray's BlogCFC, I'll show a few quick changes you can make that will make them much easier for your users to read.

Sound counter-intuitive? Aren't captcha's supposed to be difficult to read, to hamper spammers? In my last entry, I made a call for simplifying captchas and why they aren't all bad. As a blog owner who uses them to weed out the random spambots who would otherwise clog my comments and feedback mechanisms, I like captchas, and I'm grateful for the work Peter's done.

That said, I have to admit that as I've encountered them in the blogs of others, I've grown a tad weary of their complexity. They require the user to type several characters and have several swirly ovals, random lines, and a wavy background. Frankly they're quite hard to read, and it would be a shame to lose commenters for that reason.

hard captcha

Again, the intent is to make it hard for some spammer to scan the captcha request somehow and figure out what's being requested so as to automate around it. Fair enough, but as I said in my last entry I'm really not that concerned about protecting my site from determined break-ins. I'm not a bank. I just want to keep out the automated pests.

With just a couple of changes to Lyla's captcha.xml file, you'll have a much simplified captcha, if you want one.

hard captcha

Lyla is highly customizable

On a lark, I decided to try to find out if Lyla might just be modifiable to dial down the intensity. Turns out it is, by simple changes in the lyla captcha.xml file, as documented in this PDF. Thanks again, Peter! :-)

After a few simple tweaks, I reduced my captcha to just asking for 3 characters, all lowercase, without all the swirly ovals, lines, and wavy background.

Changing Lyla's captcha.xml

In BlogCFC, the captcha.xml file is located in blog\client\includes (or just \includes if you've installed the blog client directory as your webroot.)

To effect the change I wanted, I ended up with the following values for the following entries. Again, see the docs for more info:

<config name="randStrType" value="alphaLcase"/>
<config name="randStrLen" value="3"/>
<config name="fontColor" value="dark"/>
<config name="backgroundColor" value="light"/>
<config name="useGradientBackground" value="false"/>
<config name="backgroundColorUseCyclic" value="false"/>
<config name="useOvals" value="false"/>
<config name="useBackgroundLines" value="false"/>
<config name="useForegroundLines" value="false"/>

You can change them to suit your taste. Note that if you do change the randStrLen, the value selected represents the "average" length of the string that users will be asked to enter, and may vary by +/- 1 from that.

Make the changes, and check 'em out for yourself. Note that with Ray's BlogCFC, you need to reinitialize the blog (add ?reinit=1 to your blog URL) to see the changes. What I did was had one browser page open to do that, and another sitting on a blog comment form. After running the reinit, I could then just reload the comment page to see the impact. (If there's a still-simpler way to test changes to the captcha.xml, let me know.)

If you don't use BlogCFC, then you have to re-instantiate the captcha object after making changes to the XML file. If you've stored it in a shared scope (like application), you need to run some code that reloads it. Of course, restarting ColdFusion will also reload the CFC in whatever scope you stored it in.


Making these changes won't solve the accessibility problems some have with captchas, and it certainly could increase the risk of a determined spammer more easily breaking your captcha. As I said in the last entry, I doubt that's a real concern for most of us. If it proves to be so, then you can dial the intensity back up.

I just want to keep from annoying my readers, and I hope others will consider these changes to keep from annoying us all. :-)

PS: I do realize that one could skip the captcha graphic entirely and just go to prompting the user for a random string. That may just a bit "too" easy for a spambot to get around. To each his own.

Thanking Peter

One last note: while Peter certainly appreciates your kind comments (and do share them, as I'm sure many don't bother), those who REALLY appreciate his work should note that he gratefully accepts contributions by way of his Amazon Wishlist or you may may make a donation with PayPal, using his address, pjf@maestropublishing.com.


You should give CFAkismet a look-- integrating it will pretty much elimate the need to bother your blog commenters with CAPTCHA. I personally don't use ColdFusion for my blog, but I created the API in hopes of getting CF based blogs to catch-up with some of the anti-spam technology the rest of the blogosphere is using which doesn't make users jump through hoops.


I'd say it's pretty much a 1.0 release at this point given that I've fixed the few bugs found by others, I just need to add some documentation and a downloadable zip file which only contains the component.
# Posted By Brandon Harper | 8/18/06 3:18 AM
I should add-- since I updated my blog software (WordPress) exactly 2 weeks ago, it's automagically protected me against 2,129 spam comments an trackbacks and not let any false positives by.
# Posted By Brandon Harper | 8/18/06 3:22 AM
I shouldn't be posting comments this late-- I meant to say Akismet (the network that CFAkismet interfaces with) was what prevented the spam, which is now a standard part of WordPress 2.x, instead of sounding like WordPress itself did it.
# Posted By Brandon Harper | 8/18/06 3:25 AM
Thanks, Brandon. I will give that a look.
# Posted By Charlie Arehart | 8/18/06 9:58 AM
Very nice, Charlie! Thanks! Ken.
# Posted By Ken Reiss | 8/30/06 10:45 PM
I want to add a post-mortem on this entry from nearly a month ago. Since simplifying my captcha, I've not had a single spam comment, so clearly it didn't hurt, and I hope it helped my readers enter comments more easily. That should help them and me (as I like comments) and otehr readers (who would appreciate their comments).

Sadly, I just was using someone else's blog which uses BlogCFC, and I had to enter the catpcha value 3 times because it was the standard "complicated" one. I hope others will please consider implementing this change. You have nothing to lose (it seems) and potentially much to gain (if users ever give up in frustration and skip bothering trying to leave you their comment).

I saw that Ray has said he will consider implementing these simpler specifications in the lyla xml file as he distributes it. that wuold be great.
# Posted By Charlie Arehart | 9/12/06 2:59 PM
Hi Charlie,

Many thanks, you've done the community a great service. I lost count of how many times I have had problems with my own captcha. I have implemented this already and I love it!

Great job, many thanks.

It was the little details (exact xml changes and the reminder to reinit along with the URL variable name) that made this such a gem. Read post, make tweaks, call page, change for the better made in under 5 minutes!!!

Thanks for taking the time!
# Posted By Peter Bell | 9/14/06 1:01 PM
Thanks very much, Peter. It's enthusiastic replies like that which make it all worthwhile. :-) The challenge now is to get users of the catpcha (bloggers, or blog readers) to know about the option. Anything you can do to spread the news would be greatly appreciated.
# Posted By Charlie Arehart | 9/14/06 2:55 PM
Hi Charlie,

I'm pretty sure a lot more people read your blog than mine, but I'll definitely mention your posting on the off chance it helps!

Best Wishes,
# Posted By Peter Bell | 9/14/06 3:07 PM
# Posted By Peter Bell | 9/14/06 3:22 PM
This has been rolled in 5.5.
# Posted By Raymond Camden | 9/17/06 11:33 AM
Sweet! Although when is that coming out? I haven't even got round to upgrading from 5.005 yet :-<
# Posted By Peter Bell | 9/17/06 11:40 AM
I will make the following promises:

BlogCFC 5.5 will be released before Vista. Before ColdFusion 8. Before I actually get my HDTV. Before I lose 20 pounds.

In all seriousness, it is very close. I need to wrap up testing on the first feature I added, new render tags, which kind of got forgotten. I'm pretty sure it's broken on BlueDragon, but I haven't gotten to test it yet. I also want to ensure XML-RPC is really there. It 'seems" to be, but with all the different clients and with them all being a little bit different, it may not be 100% there. Lastly - I need to update the documentation. All in all - very darn close.

I'm also making plans for 6.0.
# Posted By Raymond Camden | 9/17/06 11:50 AM
I did copy your xml file(captcha) and replaced with the one I had. But for whatever reason I don't see the changes in the image at all. Other then replacing the file(editing xml file), do I have to do anything else?
# Posted By Nita | 10/25/07 1:02 PM
uhhh, it's funny. I had to reboot my PC for something else and now my image is showing fine and has all the changes I made in xml file. Do you think something needs to be done when a change in xml file?
# Posted By Nita | 10/25/07 4:00 PM
Nita, you didn't need to reboot your PC. You don't even need to restart CF, which would have been the first thing to try if I hadn't told you what to do. :-)

I had said above in the blog entry, "Make the changes, and check 'em out for yourself. Note that with Ray's BlogCFC, you need to reinitialize the blog (add ?reinit=1 to your blog URL) to see the changes."
# Posted By Charlie Arehart | 10/25/07 6:29 PM
Thanks Charlie. Sorry for not paying much attention to the text.
# Posted By Nita | 10/26/07 12:28 AM
When you make changes to the XML file you have to reload the instance of the capctha CFC that is stored in the application scope. This is why your settings didn't change until after reboot.
# Posted By WilGeno | 11/26/07 3:05 PM
@WilGeno, as I said in a comment just before yours, you should just need to reinitialize blogCFC as I showed. Are you saying that's not enough in your observation?
# Posted By Charlie Arehart | 11/26/07 4:58 PM
Well, according to me it was not enough. I am not CF expert. When I make a change to xml file, I contact my ISP and they restart cf application for me which will show the update information.
# Posted By Nita | 11/26/07 11:02 PM
Nita, this isn't about CF expertise. This is about a built-in feature of BlogCFC. Folks, I've just confirmed it. All you need to do is request your blog with the query string ?reinit=1, so for my blog, that was:


That immediately reloads the xml file (and it's also useful for a variety of other benefits, like reloading changes in the blog.ini.cfm, or reloading any cached content within the blog).

And I confirmed this on my hosted carehart.org site. It should work just fine for everyone.

Hope that's helpful.
# Posted By Charlie Arehart | 11/26/07 11:48 PM
Actually I wasn't referring to how Lyla behaved from within BlogCFC. I don't have a blog so I do not use BlogCFC. I do have other sites and I did implement Lyla Captcha and what I posted earlier is accurate as well as what you posted Charlie. Either way you have to re-instantiate the captcha object after making changes to the XML file. BlogCFC has it's method for doing so and when not using BlogCFC you simply need to reload the captcha object that you store in your application scope. Both methods are correct depending on your usage of Lyla Captcha.
# Posted By WilGeno | 11/27/07 12:16 AM
Oh, ok, well that's a horse of a different color. :-) My blog entry was clearly heavily oriented toward using Lyla within BlogCFC, though certainly it applies outside of it as well. When Nita raised her concern, she didn't mention using it outside BlogCFC, and when you posted your reply, you also didn't say you were speaking of its use outside of that. That explains all the confusion.

Anyway, thanks for the clarification. I'm sure it will help some readers. In fact, since some others may read the entry and not read all the comments, I'll add this point of clarification to the text itself.
# Posted By Charlie Arehart | 11/27/07 4:59 AM
I am using it for my feedback page on the website not for blog.
# Posted By Nita | 11/27/07 5:09 AM
BlogCFC was created by Raymond Camden. This blog is running version 5.005. (Want to validate the html in this page?)

Managed Hosting Services provided by
Managed Dedicated Hosting