PHP:GD库:增加ImageString函数的字体大小

Shy*_*yju 0 php gd

我有以下代码块,它将输出验证码图像

 $im = @imagecreatefromjpeg("captcha.jpg"); 
 $rand = _generateRandom(3);
 $_SESSION['captcha'] = $rand;
 ImageString($im, 5, 2, 2, $rand[0]." ".$rand[1]." ".$rand[2]." ", ImageColorAllocate ($im, 23, 85, 160));
Run Code Online (Sandbox Code Playgroud)

现在我想增加字体大小.我使用第二个参数为5.我知道我们只能使用1到5个.但我想增加\ font大小更多.我也想改变字体还有其他像Arial或Verdana.如何做到这一点?提前致谢

Gre*_*reg 6

听起来你最好使用imagettftext:

array imagettftext ( resource $image , float $size , float $angle , int $x , int $y , int $color , string $fontfile , string $text )
Run Code Online (Sandbox Code Playgroud)