Ver Mensaje Individual
  #1 (permalink)  
Antiguo 07/08/2008, 11:45
nngg
 
Fecha de Ingreso: marzo-2005
Mensajes: 201
Antigüedad: 19 años, 1 mes
Puntos: 0
Pregunta Texto a imagen con imagettftext: salto de linea?

Quisiera saber si es posible añadir la opcion de salto de linea en el texto que luego generará la imagen. Tengo este script de ejemplo:

Código HTML:
<?php header("Content-type: image/png");

// Crear la imagen
$im = imagecreatetruecolor(400, 30);

// Crear algunos colores
$blanco = imagecolorallocate($im, 255, 255, 255);
$gris   = imagecolorallocate($im, 128, 128, 128);
$negro  = imagecolorallocate($im, 0, 0, 0);
imagefilledrectangle($im, 0, 0, 399, 29, $gris);

// El texto a pintar
$texto = 'Probando 123';
// Reemplaze la ruta con su propia ruta a la fuente
$fuente = 'arial.ttf';

// Agregar una sombra al texto
imagettftext($im, 20, 0, 11, 21, $gris, $fuente, $texto);

// Agregar el texto
imagettftext($im, 20, 0, 10, 20, $negro, $fuente, $texto);

// Usar imagepng() resulta en texto más claro, en comparación con imagejpeg()
imagepng($im);
imagedestroy($im);
?>