PHP imagecharup - 垂直地画一个字符


imagecharup — 垂直地画一个字符。

语法

  1. bool imagecharup ( resource $image , int $font , int $x , int $y , string $c , int $color )

imagecharup() 将字符 c 垂直地画在 image 指定的图像上,位于 x,y(图像左上角为 0, 0),颜色为 color。如果 font 为 1,2,3,4 或 5,则使用内置的字体。

实例

  1. <?php
  2.  
  3. $im = imagecreate(100,100);
  4.  
  5. $string = 'Note that the first letter is a N';
  6.  
  7. $bg = imagecolorallocate($im, 255, 255, 255);
  8. $black = imagecolorallocate($im, 0, 0, 0);
  9.  
  10. // 在白色的背景上输出黑色的 "Z"
  11. imagecharup($im, 3, 10, 10, $string, $black);
  12.  
  13. header('Content-type: image/png');
  14. imagepng($im);
  15.  
  16. ?>

以上实例输出结果的图片如下: