I made my own, here it is.
There is no color collision checking on the one with the coloured background so it may be unreadable in some circumstances.
With a white background:
Code: Select all
<?php
session_start();
header("Content-type: image/png");
$im = @imagecreate(200, 400)
or die;
$background_color = imagecolorallocate($im, 255, 255, 255);
for($i=1;$i<=8;$i++){
$n=rand(0,9);
$x=rand(0,225);
$y=rand(0,225);
$z=rand(0,225);
$mapx=$mapx+10;
$tc = imagecolorallocate($im, $x, $y, $z);
imagestring($im, 50, $mapx, 20, $n, $tc);
}
$_SESSION['code'] = $rand;
imagepng($im);
imagedestroy($im);
?>
With a coloured background:
Code: Select all
<?php
session_start();
header("Content-type: image/png");
$im = @imagecreate(100, 27)
or die("Cannot Initialize new GD image stream");
$bx=rand(0,225);
$by=rand(0,225);
$bz=rand(0,225);
$background_color = imagecolorallocate($im, $bx, $by, $bz);
for($i=1;$i<=8;$i++){
$n=rand(0,9);
$x=rand(0,225);
$y=rand(0,225);
$z=rand(0,225);
$mapx=$mapx+10;
$tc = imagecolorallocate($im, $x, $y, $z);
imagestring($im, 50, $mapx, 7, $n, $tc);
}
$_SESSION['code'] = $rand;
imagepng($im);
imagedestroy($im);
?>
Pax.
Both pieces of code are licensed under a Creative Commons Attribution 3.0 Australia License