Latest web development tutorials

PHP imagechar - write transverse character

PHP Image Processing PHP Image Processing

imagechar - write transverse character.

grammar

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

imagechar () will be the first character string c painted image of the specified image, which is located in the upper left corner x, y (top left is 0, 0), the color is color. If the font is 3, 4 or 5, use the built-in fonts (larger number corresponding to larger fonts).

Examples

<?php
$im = imagecreate(100,100);

$string = 'PHP';

$bg = imagecolorallocate($im, 255, 255, 255);
$black = imagecolorallocate($im, 0, 0, 0);

// 左上角输出字符 P
imagechar($im, 5, 0, 0, $string, $black);

header('Content-type: image/png');
imagepng($im);
?>

The above example of the output picture is as follows:

PHP Image Processing PHP Image Processing