imagechar 水平地画一个字符

发表日期:2021-07-01 08:55:56 | 来源: | | 浏览(900) 分类:GD 和图像处理 函数

imagechar

(PHP 4, PHP 5, PHP 7, PHP 8)

imagechar水平地画一个字符

说明

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

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

示例 #1 imagechar() 例子

1<?php
2$im = imagecreate(100,100);
3$string 'PHP';
4$bg = imagecolorallocate($im, 255, 255, 255);
5$black = imagecolorallocate($im, 0, 0, 0);
6// prints a black "P" in the top left cornerimagechar($im, 1, 0, 0, $string, $black);
7header('Content-type: image/png');
8imagepng($im);
9?>

参见 imagecharup()imageloadfont()

集速网 copyRight © 2015-2022 宁ICP备15000399号-1 宁公网安备 64010402001209号
与其临渊羡鱼,不如退而结网
欢迎转载、分享、引用、推荐、收藏。