May 9, 2022
Using CFImage to create CAPTCHAS
Comments
(0)
May 9, 2022
Using CFImage to create CAPTCHAS
ColdFusion developer for 20+ years, professional experience in 10 other languages & frameworks. Artist, nerd, Jeep enthusiast.
Newbie 35 posts
Followers: 26 people
(0)

Quick hit blog post here, did you know that ColdFusion can generate CAPTCHA images for you? While there are, of course, other CAPTCHA image generators & frameworks out there, if you’re just looking for a simple solution, you’ve already got one built in to CF.

Consider the following code:

<cfscript>
cfimage(action=”captcha”, text=”OMGWHAT”, difficulty=”medium”, fontSize=”18″);
</cfscript>

This code would generate a randomly styled CAPTCHA image, similar to this:
Sample CAPTCHA image

ColdFusion supports different difficulties, font-sizes and fonts, and of course you can dynamically generate the CAPTCHA text yourself to check against a server variable to help prevent bots from posting to your forms.

Of course, the cfimage() function can also add borders to images, convert them to different formats, resize them, rotate them and much more.

Get more info & learn what else this function can do here: https://helpx.adobe.com/coldfusion/cfml-reference/coldfusion-tags/tags-i/cfimage.html

0 Comments
Add Comment