Draw a character vertically
Syntax
imagecharup( GdImage $image, GdFont|int $font, int $x, int $y, string $char, int $color ): bool
Parameters
image
A GdImage object, returned by one of the image creation functions, such as imagecreatetruecolor().
font
Can be 1, 2, 3, 4, 5 for built-in fonts in latin2 encoding (where higher numbers corresponding to larger fonts) or GdFont instance, returned by imageloadfont().
x
x-coordinate of the start.
y
y-coordinate of the start.
char
The character to draw.
color
A color identifier created with imagecolorallocate().
Return
Returns true on success or false on failure.
Examples
1 · return
<? $width = 100; $height = 100; $image = imagecreatetruecolor($width, $height); $red = 0; $green = 0; $blue = 0; $color = imagecolorallocate($image, $red, $green, $blue); $font = 1; $x = 0; $y = 100; $char = "c"; $return = imagecharup($image, $font, $x, $y, $char, $color); var_export($return); ?>
true
2 · base64
<? $width = 100; $height = 100; $image = imagecreatetruecolor($width, $height); $red = 255; $green = 255; $blue = 255; $color = imagecolorallocate($image, $red, $green, $blue); $font = 1; $x = 0; $y = 100; $char = "c"; imagecharup($image, $font, $x, $y, $char, $color); ob_start(); imagepng($image); $output = ob_get_clean(); echo '<!doctype html> <html> <body> <img src="data:image/png;base64,' . base64_encode($output) . '"> </body> </html>'; ?>
<!doctype html> <html> <body> <img src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAGQAAABkCAIAAAD/gAIDAAAACXBIWXMAAA7EAAAOxAGVKw4bAAAARUlEQVR4nO3QoQ0AMAwDwSj77+zwsJZUle7QQ8tVAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFxIsoKlXw/4ibMODDYQBf8lvpKjAAAAAElFTkSuQmCC"> </body> </html>