zoukankan      html  css  js  c++  java
  • 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

     问题解决! 

  • 相关阅读:
    小议如何使用APPLY
    SQLServer复制(二)--事务代理作业
    T-SQL—理解CTEs
    jdbc与java.sql
    java设计模式之中介者模式
    fread函数和fwrite函数
    Linux多线程编程(不限Linux)
    poj 3320 技巧/尺取法 map标记
    poj 1260 dp
    HDU 4311 前缀和
  • 原文地址:https://www.cnblogs.com/DaBing0806/p/5416542.html
Copyright © 2011-2022 走看看