Ask how to change the size of the characters in the verification

Source: Internet
Author: User
How can I change the text size in the verification? Http://pan.baidu.com/share/link? Upload id = 343815 & amp; uk = 1865794164 & nbsp; I don't know what's going on. I can't upload the image. I 've put the image on Baidu's online storage. For example, how can I change the size of the characters in the verification? The code is as follows: & lt ;? Php & nbsp; se how can I change the size of the characters in the verification?
Http://pan.baidu.com/share/link? Upload id = 343815 & uk = 1865794164 I don't know what's going on. I can't upload images. I 've put the images on a Baidu online disk.

For example, how can I change the size of the characters in the verification?

The code is as follows:
  
session_start();
//session_register('SafeCode');
$type = 'gif';
$width= 92;
$height= 30;
header("Content-type: image/".$type);
srand((double)microtime()*1000000);
$randval = randStr(4,"");
if($type!='gif'&&function_exists('imagecreatetruecolor')){
$im = @imagecreatetruecolor($width,$height);
}else{
$im = @imagecreate($width,$height);
}
$r = Array(225,211,255,223);
$g = Array(225,236,237,215);
$b = Array(225,236,166,125);
$key = rand(0,3);
$backColor = ImageColorAllocate($im,$r[$key],$g[$key],$b[$key]);
$borderColor = ImageColorAllocate($im,0,0,0);
$pointColor = ImageColorAllocate($im,255,170,255);
@imagefilledrectangle($im,0,0,$width -1,$height -1,$backColor);
@imagerectangle($im,0,0,$width-1,$height-1,"");
$stringColor = ImageColorAllocate($im,555,51,153);
for($i=0;$i<=100;$i++){
$pointX = rand(2,$width-2);
$pointY = rand(2,$height-2);
@imagesetpixel($im,$pointX,$pointY,$pointColor);
}
@imagestring($im,10,10,2,$randval,$stringColor);
$ImageFun='Image'.$type;
$ImageFun($im);
@ImageDestroy($im);
$_SESSION['validationcode'] = $randval;
function randStr($len=6,$format='NUMBER') {
switch($format) {
case 'ALL':
$chars='0123456789';break;
case 'CHAR':
$chars='';break;
case 'NUMBER':
$chars='0123456789';break;
default :
$chars='0123456789';
break;
}
$string="";
while(strlen($string)<$len)
$string.=substr($chars,(mt_rand()%strlen($chars)),1);
return $string;
}
;echo ' ';
?>

------ Solution --------------------
In any case, the manual is always visible. That is the basis for your behavior

Imagestring -- draw a line of strings horizontally
Description
Bool imagestring (resource image, int font, int x, int y, string s, int col)

Imagestring () uses the col color to draw string s to the x and y coordinates of the image (this is the coordinate of the upper left corner of the string, and the upper left corner of the entire image is 0, 0 ). If the font is 1, 2, 3, 4, or 5, the built-in font is used.


Imagettftext -- use TrueType to write text to the image
Description
Array imagettftext (resource image, float size, float angle, int x, int y, int color, string fontfile, string text)




Image
Image resources. See imagecreatetruecolor ().

Size
Font size. Based on the GD version, the pixel size (GD1) or the point size (GD2) should be specified ).

Angle
The angle. The value 0 is the text read from left to right. A higher value indicates a counter-clockwise rotation. For example, 90 degrees indicates the text read from the bottom up.

X
The coordinates represented by x and y define the basic points of the first character (probably the lower left corner of the character ). Unlike imagestring (), x and y define the upper left corner of the first character. For example, "top left" is 0 and 0.

Y
Y coordinate. It sets the font baseline position, not the bottom of the character.

Color
Color index. Using a negative color index value can disable anti-aliasing. See imagecolorallocate ().

Fontfile
Is the path of the TrueType font to be used.

Depending on the GD library used by PHP, when fontfile does not start with/,. ttf will be added to the file name and will try to search for the file name in the library-defined font path.

When the GD Library version is earlier than 2.0.18, a space character instead of a semicolon will be used as the "path separator" for different font files ". When you accidentally use this feature, a Warning message is generated: Warning: cocould not find/open font. The only solution for affected versions is to move the font to a path without spaces.

In many cases, the font is placed in the same directory of the script. The following tips can alleviate the problems involved.
Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.