zoukankan      html  css  js  c++  java
  • php 使用imagettftext()函数出问题的原因

    <?php
    header('Content-type: image/png');
    $im = imagecreatetruecolor(400, 300); //创建画布
    $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);    //输出一个白色填充的矩形背景
    //
    ////string iconv  ( string $in_charset  , string $out_charset  , string $str  )
    ////将字符串 str 从 in_charset 转换编码到 out_charset。
    //
    $text = iconv('gb2312','utf-8','show');
    //
    ////设置字体
    $font = 'C:WindowsFontsmsyh.ttc';
    //
    imagettftext($im, 20, 0, 12, 21, $grey, $font, $text); //输出一个灰色字符串作为阴影
    //imagettftext($im, 20, 0, 10, 20, $black, $font, $text); //输出一个黑色字符串
    //ob_clean();
    imagepng($im);
    imagedestroy($im);

    设置字体的时候要写路径,不然就画不出来了

  • 相关阅读:
    IfcRoot
    IfcMaterial
    IfcDirection
    IfcAxis2Placement3D
    IfcBeam属性
    osg::Node源码
    不规则形状的Ifc构件顶点坐标获取
    不规则的Ifc构件顶点提取方法
    osg::Group源码
    Qt 图片缩放参数计算
  • 原文地址:https://www.cnblogs.com/tumio/p/4891834.html
Copyright © 2011-2022 走看看