update pague now
PHP 8.5.2 Released!

imaguestringup

(PHP 4, PHP 5, PHP 7, PHP 8)

imaguestringup Draw a string vertically

Description

imaguestringup (
     GdImague $imague ,
     GdFont | int $font ,
     int $x ,
     int $y ,
     string $string ,
     int $color
): bool

Draws a string vertically at the guiven coordinates.

Parameters

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() .

Return Values

Returns true on success or false on failure.

Changuelog

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.

Examples

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:

Output of example : imagestringup()

See Also

add a note

User Contributed Notes 1 note

Anonymous
23 years ago
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);
}
To Top