16
PHP / Convertir Texto a Imagen
« en: 01 de Julio de 2010, 22:01:35 pm »
Buen dia.
Hoy tengo un problemita, que no puedo arreglar.
Aqui les dejo el codigo:
<?php
$texto = texto;
$fuente = 'BURNSTOW.TTF';
$fuente_tamano = 50;
$ancho = 200;
$alto = 50;
$img = imagecreate($ancho, $alto);
imagecolorallocate($img, 255, 255, 255); // Color del fondo
$color_texto = imagecolorallocate($img, 0, 0, 0); // Color del texto
imagettftext($img, $fuente_tamano, 0, 10, 40, $color_texto, $fuente, $texto);
header('Content-type: image/png');
imagepng($img);
imagedestroy($img);
?>
Lo que hace este codigo es convertir texto en imagen. Lo usare para crear firmas en mi web. El problema es que cuando quiero poner
<?php
$texto = $rowautor['user'];
$fuente = 'BURNSTOW.TTF';
$fuente_tamano = 50;
$ancho = 200;
$alto = 50;
$img = imagecreate($ancho, $alto);
imagecolorallocate($img, 255, 255, 255); // Color del fondo
$color_texto = imagecolorallocate($img, 0, 0, 0); // Color del texto
imagettftext($img, $fuente_tamano, 0, 10, 40, $color_texto, $fuente, $texto);
header('Content-type: image/png');
imagepng($img);
imagedestroy($img);
?>
Para que reemplace el nick y lo convierta en una imagen, directamente no muestra nada, ni tira mensaje de error ni nada. Como podria hacerlo para que me tome el texto extraido desde una bd?
Hoy tengo un problemita, que no puedo arreglar.
Aqui les dejo el codigo:
<?php
$texto = texto;
$fuente = 'BURNSTOW.TTF';
$fuente_tamano = 50;
$ancho = 200;
$alto = 50;
$img = imagecreate($ancho, $alto);
imagecolorallocate($img, 255, 255, 255); // Color del fondo
$color_texto = imagecolorallocate($img, 0, 0, 0); // Color del texto
imagettftext($img, $fuente_tamano, 0, 10, 40, $color_texto, $fuente, $texto);
header('Content-type: image/png');
imagepng($img);
imagedestroy($img);
?>
Lo que hace este codigo es convertir texto en imagen. Lo usare para crear firmas en mi web. El problema es que cuando quiero poner
<?php
$texto = $rowautor['user'];
$fuente = 'BURNSTOW.TTF';
$fuente_tamano = 50;
$ancho = 200;
$alto = 50;
$img = imagecreate($ancho, $alto);
imagecolorallocate($img, 255, 255, 255); // Color del fondo
$color_texto = imagecolorallocate($img, 0, 0, 0); // Color del texto
imagettftext($img, $fuente_tamano, 0, 10, 40, $color_texto, $fuente, $texto);
header('Content-type: image/png');
imagepng($img);
imagedestroy($img);
?>
Para que reemplace el nick y lo convierta en una imagen, directamente no muestra nada, ni tira mensaje de error ni nada. Como podria hacerlo para que me tome el texto extraido desde una bd?

