For ($ I = 0; $ I <6; $ I ++ ){
- $ _ Md_color = imagecolorallocate ($ _ img, mt_rand (0,255), mt_rand (0,255), mt_rand (0,255 ));
- Imageline ($ _ img, mt_rand (0, 75), mt_rand (0, 75), mt_rand (0, 75), mt_rand (0, 75), $ _ md_color );
- }
- // Random snowflake
- For ($ I = 0; I I <100; $ I ++ ){
- $ _ Md_color = imagecolorallocate ($ _ img, mt_rand (200,255), mt_rand (200,255), mt_rand (200,255 ));
- Imagestring ($ _ img, 1, mt_rand (1, $ _ width), mt_rand (1, $ _ height), '*', $ _ md_color );
- }
- // Black border
- $ _ Black = imagecolorallocate ($ _ img, 0, 0, 0 );
- Imagerectangle ($ _ img, 0, 0, $ _ width-1, $ _ height-1, $ _ black );
- // Output the verification code
- For ($ I = 0; $ I $ _ Mt_color = imagecolorallocate ($ _ img, mt_rand (0,100), mt_rand (0,150), mt_rand (0,200 ));
- Imagestring ($ _ img, mt_rand (3, 5), $ I * $ _ width/4 + mt_rand (1, 10), mt_rand (1, $ _ height/2 ), $ _ SESSION ['code'] [$ I], $ _ mt_color );
- }
- Header ('content-Type: image/png ');
- Imagepng ($ _ img );
- // Destroy
- Imagedestroy ($ _ img );
- ?>
|