How to change the font size of the php verification code [color = # 0000FF] the number displayed in the verification code image is too small. how can I change the font size in the following code, is that the number is bigger [/color]
// Generate a verification code Image
Header ("Content-type: image/PNG ");
$ Rand = "";
For ($ I = 0; $ I <4; $ I ++ ){
$ Rand. = dechex (rand (0, 15 ));
}
$ Im = imagecreate (, 50); // specify the image background size.
$ Black = ImageColorAllocate ($ im, 0, 0); // you can specify three colors.
$ White = ImageColorAllocate ($ im, 255,255,255 );
$ Gray = ImageColorAllocate ($ im, 200,200,200 );
For ($ I = 0; $ I <3; $ I ++ ){
$ Te = imagecolorallocate ($ im, rand (0,255), rand (0,255), rand (0,255 ));
}
Imagefill ($ im, $ gray); // use the area filling method, set)
While ($ rand = rand () % 100000) <10000 );
// Print the four-digit integer verification code into the image
$ _ SESSION ['Rand'] = $ rand;
Imagestring ($ im, 5, 30, 20, $ rand, $ te );
// Use the col color to draw the string s to the x and y coordinates of the image (0 and 0 in the upper left corner of the image ).
// If the font is 1, 2, 3, 4, or 5, use the built-in font.
For ($ I = 0; $ I <200; $ I ++) // add interference pixels
{
$ Randcolor = ImageColorallocate ($ im, rand (0,255), rand (0,255), rand (0,255 ));
Imagesetpixel ($ im, rand () % 100, rand () % 50, $ randcolor );
}
Imageline ($ im, 0, rand (0,100), 100, rand (0, 15), $ randcolor );
Imageline ($ im, 0, rand (0,100), 100, rand (0, 15), $ randcolor );
Imageline ($ im, 0, rand (0,100), 100, rand (0, 15), $ randcolor );
ImagePNG ($ im );
ImageDestroy ($ im );
?>
Reply to discussion (solution)
Imagestring ($ im, 5, 30, 20, $ rand, $ te); this function uses a built-in font in the range of 1-5. You can only change to the imagettftext () function.
Thank you!
How can this problem be solved!