Ver Mensaje Individual
  #2 (permalink)  
Antiguo 27/06/2010, 07:34
thezzin
 
Fecha de Ingreso: septiembre-2008
Mensajes: 350
Antigüedad: 18 años, 1 mes
Puntos: 31
Respuesta: Generar img con php

Hola, Un parche facil es que lo encapsules en una funcion

Código PHP:
<?php
function img(){
$user = @$_REQUEST['user'];
$image = "images/fondo.png";
$im = imagecreatetruecolor(400, 30);

// Crear algunos colores
$blanco2 = imagecolorallocate($im, 255, 255, 255);
$gris2   = imagecolorallocate($im, 128, 128, 128);
$negro2  = imagecolorallocate($im, 0, 0, 0);

// El texto a pintar
$texto = @$_REQUEST['user'];
// Reemplaze la ruta con su propia ruta a la fuente
$fuente = 'C:/Windows/Fonts/BRUSHSCI.ttf';

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

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




$ext = substr($image, -3);
$im2 = imagecreatefrompng($image);

imagecopy($im2, $im, 5, 5, 0, 0, imagesx($im), imagesy($im)); //Comentario al final
header("Content-Type: image/png");
imagepng($im2);
imagedestroy($im);
imagedestroy($im2);
}
$img = img();
echo 
$img;
?>
y para poner texto image.php?user=Cualquier Nombre

si es lo que te entendí



-
__________________
╬-----╬
║☺₧☻║
╬-----╬