Page 1 of 1

some questions about CAP image verification.

Posted: Sun Jun 27, 2010 8:46 pm
by mefarsem
first, here is my cap php code:

Code: Select all

session_start();

header("Content-type: image/png");
$im = @imagecreate(110, 40)
    or die("Cannot Initialize new GD image stream");
$background_color = imagecolorallocate($im, 255, 255, 255);
$text_color = imagecolorallocate($im, 33, 25, 57);
$rand = rand(11111111,99999999);
imagestring($im, 50, 20, 20,  $rand, $text_color);   

$_SESSION['code'] = $rand;

imagepng($im);
imagedestroy($im);
it shows me an image with white background, (and changin' numbers of course).
i whould like to know how can i change the background that displays behind the numbers, and also change numbers color randomaly?

thanks, sorry for my english =)