« back to folderblog
folderblogwiki

PimpMyCaptcha

The CAPTCHA Functionality of Folderblog3.x is important and a major bonus, that every Folderblog2-Photoblogger has been waiting for.

For People that want to adjust the colors of the CAPTCHA (background, lines, font-color) i found a hint in a comment posted in Jowras Weblog, and can be seen in action in Jowras Almanac Template.
Pimp the Original CAPTCHA
In the fb_captcha.php file you find several calls of
imagecolorallocate($image, intR, intG, intB)
.
To change colors you only need to know the order :
1) background-color
2) font-color
3) diagonal 1
4) diagonal 2
When opening the file in an editor, you will see, that a color is defined by three values (RGB) between 0 and 255 - IntR, IntG and IntB. Alternatively you can use
rand(IntFrom, IntTo)
to let each worth be chosen from within a certain range by chance.

Alternative CAPTCHA Function
In some cases, you might even want to change the font.
So, this one is a replacement to the fb_captcha.php you find in the Folderblog 3 zip.
The only difference to the original captcha file is that it uses a truetype font of your choice and some acrobatics to turn letters a bit around their axis.

Installation:
1) Make a copy of the original fb_captcha.php or rename it to fb_captcha.bak
2) Upload a truetype-font of your choice into your folderblog-directory and rename it to fontfile.ttf
3) Download the Alternative CAPTCHA, and extract the zip-file. (i included a sample freefont for simplicity)
4) Upload the new fb_captcha where the Original was sitting. Done.

Similar to the Original file, you can change dimensions, colors and/or color-ranges by adjusting Pixel and/or RGB-values. (You can also change font-sizes, letter-position, angle of letter-rotation, etc.)

No big functional profit, but possibly useful for your templating process or just to protect your script from comment spam.

UPDATE:
(August 13, 2006) I added support for PHP-Versions prior to 4.3 where str_shuffle() isn't available. You will at least need PHP 3.0.8 to use the Captcha. (anyway no one should really use PHP-Versions older than or equal 4.1). I have posted some more detailed infos on the CAPTCHA on my weblog in german language (for those of you who want additional Infos in meiner Muttersprache)
;)
Home  Index  Recent Changes  folderblog
Last edited February 23, 2008 at 10:51pm.(edit this entry)