PHP imagechar() 图形验证码 字体太小问题

bool imagechar ( resource $image , int $font , int $x , int $y , string $c , int$color )

imagechar() 将字符串 c 的第一个字符画在 image 指定的图像中,其左上角位于 xy(图像左上角为 0, 0),颜色为 color。如果 font 是 1,2,3,4 或 5,则使用内置的字体(更大的数字对应于更大的字体)。

 

Example #1 imagechar() 例子

<?php
    @header("Content-type: image/png");
    $im = imagecreatetruecolor(400, 30);

    $white = imagecolorallocate($im, 255, 255, 255);
    $grey = imagecolorallocate($im, 128, 128, 128);
    $black = imagecolorallocate($im, 0, 0, 0);
    imagefilledrectangle($im, 0, 0, 399, 29, $white);

    $text = 'Testing...';
    $font = 'arialnarrow.ttf';
    $font_size=12;
    $wing=0;
    $left=5;
    $high=21;

    imagettftext($im, $font_size, $wing, $left,$high, $grey, $font, $text);
  
    imagepng($im);
    imagedestroy($im);
?>

   解决方案:更换字体,例如  arialnarrow.ttf

 问题解决! 

转载于:https://www.cnblogs.com/DaBing0806/p/5416542.html

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值