Duda sobre imagenes dinamicas con php

jptosso

New Member
Messages
200
Reaction score
0
Points
0
bueno, pasa ke kiero hacer firmas dinamicas para mi clan donde salgan sus estadisticas, el archivo es http://clancmc.uni.cc/firma.png , ya da el fondo XD
bueno, aki va el codigo:

PHP:
<?php
    $im = imagecreatefrompng("fondo.png");
$gris   = imagecolorallocate($im, 128, 128, 128);
$fuente = 'adelain.ttf';
$nombre=$_GET['nombre'];
if($_GET['m']=="")
{

}
else
{
include('cm.php');
$res1=mysql_query("SELECT 'rango' FROM miembros WHERE nombre='$nombre'");
$res2=mysql_query("SELECT 'skills' FROM miembros WHERE nombre='$nombre'");
$res3=mysql_query("SELECT 'acesinatos' FROM miembros WHERE nombre='$nombre'");
if (file_exists("users/". $nombre. ".png")) 
{
$foto="users/". $nombre. ".png";
}
}
$texto1=$res1;
$texto2=$res2;
$texto3=$res3;
$texto4=$res4;
    $size = getimagesize("fondo.png");


    // png-24
    $im_tc = imagecreatetruecolor($size[0],$size[1]);
    imagecopy($im_tc,$im,0,0,0,0,$size[0],$size[1]);
//crea los textos
    imagettftext($im, 20, 0, 10, 20, $gris, $fuente, $texto1);
    imagettftext($im, 20, 0, 10, 20, $gris, $fuente, $texto2);
    imagettftext($im, 20, 0, 10, 20, $gris, $fuente, $texto3);
    imagettftext($im, 20, 0, 10, 20, $gris, $fuente, $texto4);
    imagettftext($im, 20, 0, 10, 20, $gris, $fuente, $nombre);
    imagedestroy($im);




    //de vuelta a png 8
    $im_result = imagecreate($size[0],$size[1]);
    imagecopy($im_result,$im_tc,0,0,0,0,$size[0],$size[1]);
    imagedestroy($im_tc);
//imprime la imagen
header("Content-type: image/jpeg"); 
ImagePng($im_result);
ImageDestroy($im); 
?>

pueden fijarse en http://www.clancmc.uni.cc/firma.png?m=zeus que da muchos errores xD
Warning: imagettftext() expects parameter 8 to be string, resource given in /home/jptosso/public_html/clancmc.uni.cc/firma.png on line 31

Warning: imagettftext() expects parameter 8 to be string, resource given in /home/jptosso/public_html/clancmc.uni.cc/firma.png on line 32

Warning: imagettftext() expects parameter 8 to be string, resource given in /home/jptosso/public_html/clancmc.uni.cc/firma.png on line 33

Warning: Cannot modify header information - headers already sent by (output started at /home/jptosso/public_html/clancmc.uni.cc/firma.png:31) in /home/jptosso/public_html/clancmc.uni.cc/firma.png on line 46

bueno, espero que puedan ayudarme...

salu2 :)
 
Last edited:

cetutnx1

New Member
Messages
510
Reaction score
0
Points
0
Es que tenés un pequeño problema:

PHP:
//Cuando haces una consulta con mysql_query tenés que "transfomar" el resultado en array con mysql_fetch_array()

//En vez de tener
$res1 = mysql_query('SELECT....');
//Tenés que tener
$res1 = mysql_fetch_array(mysql_query('SELECT....'));

Ahora cuando se hace esto va a continuar dando error, porque lo que tenés que pasarle es un cadena de caracteres pura....

PHP:
//En vez de hacer 
$texto1 = $res1

//Con el cambio explicado arriva tenés que hacer
$texto1 = $res1[0];

Con eso devería funcionar de lujo...

Exitos... cualquier cosa avísa!!!!
 
Last edited:
Top