Captcha using Codeigniter

This tutorial will show you how to generate captcha image using Codeigniter Captcha Helper. The CAPTCHA Helper file contains functions that assist in creating CAPTCHA images.

The CAPTCHA helper

The captcha function requires the GD image library.
Only the img_path and img_url are required.
If a word is not supplied, the function will generate a random ASCII string. You might put together your own word library that you can draw randomly from.
If you do not specify a path to a TRUE TYPE font, the native ugly GD font will be used.
The “captcha” directory must be writable
The expiration (in seconds) signifies how long an image will remain in the captcha folder before it will be deleted. The default is two hours.
word_length defaults to 8, pool defaults to ‘0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ’
font_size defaults to 16, the native GD font has a size limit. Specify a “true type” font for bigger sizes.
The img_id will be set as the “id” of the captcha image.
If any of the colors values is missing, it will be replaced by the default.

 

Continue reading “Captcha using Codeigniter”