PHP 8.3.4 Released!

imagestringup

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

imagestringupDibujar una cadena verticalmente

Descripción

imagestringup(
    resource $image,
    int $font,
    int $x,
    int $y,
    string $string,
    int $color
): bool

Dibuja la cadena string verticalmente en las coordenadas dadas.

Parámetros

image

Un recurso image, es devuelto por una de las funciones de creación de imágenes, como imagecreatetruecolor().

font

Puede ser 1, 2, 3, 4, 5 para fuentes built-in en latin2 encoding (los números más altos corresponden a large fonts) o cualquier de sus propios identificadores de fuentes registrados con imageloadfont().

x

Coordenada x de la esquina inferior izquierda.

y

Coordenada y de la esquina inferior izquierda.

string

La cadena a escribir.

color

Un identificador de color creado con imagecolorallocate().

Valores devueltos

Devuelve true en caso de éxito o false en caso de error.

Ejemplos

Ejemplo #1 Ejemplo de imagestringup()

<?php
// crear una imagen de 100*100
$im = imagecreatetruecolor(100, 100);

// Escribir el texto
$color_texto = imagecolorallocate($im, 0xFF, 0xFF, 0xFF);
imagestringup($im, 3, 40, 80, 'gd library', $color_texto);

// Guardar la imagen
imagepng($im, './stringup.png');
imagedestroy($im);
?>

El resultado del ejemplo sería algo similar a:

Salida del ejemplo : imagestringup()

Ver también

add a note

User Contributed Notes 1 note

up
1
Anonymous
21 years ago
function imagestringdown(&$image, $font, $x, $y, $s, $col)
{
$width = imagesx($image);
$height = imagesy($image);

$text_image = imagecreate($width, $height);

$white = imagecolorallocate ($text_image, 255, 255, 255);
$black = imagecolorallocate ($text_image, 0, 0, 0);

$transparent_colour = $white;
if ($col == $white)
$transparent_color = $black;

imagefill($text_image, $width, $height, $transparent_colour);
imagecolortransparent($text_image, $transparent_colour);

imagestringup($text_image, $font, ($width - $x), ($height - $y), $s, $col);
imagerotate($text_image, 180.0, $transparent_colour);

imagecopy($image, $text_image, 0, 0, 0, 0, $width, $height);
}
To Top