HomeMenu
Jesus · Bible · HTML · CSS · JS · PHP · SVG · Applications

imagestringup

Description

The imagestringup of Image for PHP draw a string vertically.

Syntax

imagestringup(
    GdImage $image,
    GdFont|int $font,
    int $x,
    int $y,
    string $string,
    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 bottom left corner.

y

y-coordinate of the bottom left corner.

string

The string to be written.

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;
$string = "string";

$return = imagestringup($image, $font, $x, $y, $string, $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;
$string = "string";
imagestringup($image, $font, $x, $y, $string, $color);

$font = 2;
$x = 20;
$y = 100;
$string = "string";
imagestringup($image, $font, $x, $y, $string, $color);

$font = 3;
$x = 40;
$y = 100;
$string = "string";
imagestringup($image, $font, $x, $y, $string, $color);

$font = 4;
$x = 60;
$y = 100;
$string = "string";
imagestringup($image, $font, $x, $y, $string, $color);

$font = 5;
$x = 80;
$y = 100;
$string = "string";
imagestringup($image, $font, $x, $y, $string, $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/gAIDAAAACXBIWXMAAA7EAAAOxAGVKw4bAAAClklEQVR4nO2awXaEIAxFsWf+/5fpwikiIIQkhmjfXfTMWAIxkkeECQEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA4N8TY4wx1hfrlpuJP95Jodm2rf6a+DF2yyH5JLoK087HyCPfpNA0sy+BmTUBgjXBGwR+z51aZa6uN5s1Gdo+lfhH+lp8INrmf99JvaJNBYsIVsMvRUybCfhOgZ+dTcT27xGwup6cEvgnaXkhz8FQYukDeUnDYjr4XJK8CHyMsX6JnQpW3ZiYWftAlMZegiWEeLdXtoG2GjoKVlEZectBX0hq6IdFNt3hkhXNZizN4iIX6aSadDWhqAbRltFD0ZtrzRLOC5uS0kuwgnkNnQp3+nPSDFYamJGDj8DLnbBLyk6HdK0sWo41K3dXWODJ+7GE7uTRjreE5dgnXV931J1xJPA5xLjnbepU0ndLdwAtF409WbD5xxDpTh6ZZTR98++Uhv3D6yGPkPMm056vfRctRmc4w/afaagbL0lvN504XNlOa5akzkoFR9m7oe5IxiJ6/un/m0iyzTthzI4lqifKpyXiRc+FTg93G562n46r5k9YPY/CrXeh8uMA6yXpBjqe3LJTyrMtrqyq2jo1qpdDVl0k7zrUh+Tn3VA+KN2TuuWV7Wk/S77fFmT1mpYn9IGKD31IO4QG5EPT32x7YiwwH9vGjOEwbD+I7S1PWDkHFvI5lc8O+narSsliQ7kaOvF46skJHzN/Dz6wlEteQK89NMvvPVx7fvpJ1PeS9qm3DcQbbhqGard2YL48ASXiVdsy6qyh7aFZKpOCfcOF4fIn1+QIltzLQvVmu2puirmi8W4oL1seqnpDytMdxozQQqJZ+W9SwnzQ8xE7o/8C1+1vWbuDKOQAAAAASUVORK5CYII=">
</body>
</html>