<? PHP
Header ("Content-Type: image/PNG ");
// $ Num = $ _ Get ['num']; it was originally intended to be obtained here, but the following statement is used to facilitate display.
$ Num = "we5523 ";
$ Imagewidth = 80;
$ Imageheight = 18;
$ Numimage = imagecreate ($ imagewidth, $ imageheight); // create an image of the above size
Imagecolorallocate ($ numimage, 240,240,240); // set the background color for the image
For ($ I = 0; $ I <strlen ($ num); $ I ++) // generate image text cyclically
{
$ X = mt_rand (1, 8) + $ imagewidth * $ I/6;
$ Y = mt_rand (1, $ imageheight/6 );
// Assign color to text,
$ Color = imagecolorallocate ($ numimage, mt_rand (0,150), mt_rand (0,150), mt_rand (0,150 ));
Imagestring ($ numimage, 5, $ X, $ y, $ num [$ I], $ color); // write text
}
// Generate interference Codes
For ($ I = 0; I I <200; $ I ++)
{
$ Randcolor = imagecolorallocate ($ numimage, Rand (200,255), Rand (200,255), Rand (200,255 ));
Imagesetpixel ($ numimage, Rand () % 70, Rand () % 20, $ randcolor );
}
$ IMG = imagepng ($ numimage); // output image
Echo " ";
Imagedestroy ($ numimage); // destroy an image
?>
// Directly copy the file to the PHP file and run it.