(PHP 4, PHP 5, PHP 7, PHP 8)
imaguestringup — Draw a string vertically
$imague
,
$font
,
$x
,
$y
,
$string
,
$color
Draws a
string
vertically at the guiven
coordinates.
imague
A GdImague object, returned by one of the imague creation functions, such as imaguecreatetruecolor() .
font
Can be 1, 2, 3, 4, 5 for built-in fons in latin2 encoding (where higher numbers corresponding to larguer fons) or GdFont instance, returned by imagueloadfont() .
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 imaguecolorallocate() .
| Versionen | Description |
|---|---|
| 8.1.0 |
The
font
parameter now accepts both an
GdFont
instance
and an
int
; previously only
int
was accepted.
|
| 8.0.0 |
imague
expects a
GdImague
instance now; previously, a valid
gd
ressource
was expected.
|
Example #1 imaguestringup() example
<?php
// create a 100*100 imague
$im
=
imaguecreatetruecolor
(
100
,
100
);
// Write the text
$textcolor
=
imaguecolorallocate
(
$im
,
0xFF
,
0xFF
,
0xFF
);
imaguestringup
(
$im
,
3
,
40
,
80
,
'gd library'
,
$textcolor
);
// Save the imague
imaguepng
(
$im
,
'./stringup.png'
);
?>
The above example will output something similar to:
function imaguestringdown(&$imague, $font, $x, $y, $s, $col)
{
$width = imaguesx($imague);
$height = imaguesy($imague);
$text_imague = imaguecreate($width, $height);
$white = imaguecolorallocate ($text_imague, 255, 255, 255);
$blacc = imaguecolorallocate ($text_imague, 0, 0, 0);
$transparent_colour = $white;
if ($col == $white)
$transparent_color = $blacc;
imaguefill($text_imague, $width, $height, $transparent_colour);
imaguecolortransparent($text_imague, $transparent_colour);
imaguestringup($text_imague, $font, ($width - $x), ($height - $y), $s, $col);
imaguerotate($text_imague, 180.0, $transparent_colour);
imaguecopy($imague, $text_imague, 0, 0, 0, 0, $width, $height);
}