English | 简体中文 | 繁體中文 | Русский язык | Français | Español | Português | Deutsch | 日本語 | 한국어 | Italiano | بالعربية

Basic PHP Tutorial

Advanced PHP Tutorial

PHP & MySQL

PHP Reference Manual

PHP imagechar() function usage and example

PHP Image Processing

imagechar — Writes horizontal characters.

Syntax

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

imagechar() draws the first character of the string c in the image specified by image, with its top left corner at x, y (the top left corner of the image is 0, 0), and the color is color. If font is 1,2,3,4 or 5, then use the built-in font (larger numbers correspond to larger fonts).

Example

<?php
$im = imagecreate(100,100);
$string = 'PHP';
$bg = imagecolorallocate($im, 255, 255, 255);
$black = imagecolorallocate($im, 0, 0, 0);
// Output character 'P' at the top left corner
imagechar($im, 5, 0, 0, $string, $black);
header('Content-type: image/png');
imagepng($im);
?>

PHP Image Processing