class.upload.php is a powerful and mature PHP class to manage uploaded files, and manipulate images in many ways. The script is available under a GPL license.
Basically, the source of the image is a PHP script which generates and output the CAPTCHA image (and also set the CAPTCHA phrase into the session). I add a random value to the URL to make sure that the CAPTCHA is generated each time and is not taken from the cache.
See: Replace ### by javascript in the code above.
The file captcha.php is very simple:
session_start();
$captcha = new CaptchaNumbersV2(5);
$captcha->display();
$_SESSION['captcha'] = $captcha->getString();
exit();
Basically, the source of the image is a PHP script which generates and output the CAPTCHA image (and also set the CAPTCHA phrase into the session). I add a random value to the URL to make sure that the CAPTCHA is generated each time and is not taken from the cache.
See:
Replace ### by javascript in the code above.
The file captcha.php is very simple: