Ver Mensaje Individual
  #1 (permalink)  
Antiguo 30/07/2008, 13:53
Avatar de hulray
hulray
 
Fecha de Ingreso: septiembre-2006
Mensajes: 630
Antigüedad: 20 años, 1 mes
Puntos: 3
crear una imagen.png usando index.php

Necesito hacer una prueba que se pueda imprimir, todo me funciona muy bien hasta que intento hacer el while, lo coloco y se me borra la imagen. Alguna forma de hacer un examen aleatorio de este modo?.

Algun ejemplo que me puedan dar, o algun paso que este haciendo mal.

Muchas gracias, les dejo el codigo.

Código PHP:
<?
if ($id=='') die ("You can't access this file directly...");
if (
$id==' Ingresar') die ("Impresion no disponible");
include_once(
"../../../am_config.php");
include_once(
"../../../proyectos.php");
include_once(
"../../../am_core/mysql.lib.php");
$conn = db_connect($config["host"],$config["database"],$config["user"],$config["password"]) or die( db_error() );
Header("Content-type: image/png");

$con_sql = "select * from am_certificado where cer_id='$id'";
    
$ret     = db_query($con_sql) or die(db_error());
    
$row     = db_fetch_array($ret);
    
$f_folio      = $row["cer_id"];
    
$f_codest     = $row["cer_estado"];
    
$f_empresa   = $row["cer_nomemp"];
    
$f_fecha1    = $row["cer_fecha1"];
    
$f_ni_aa1    = substr($f_fecha1,0,4);
    
$f_ni_mm1    = substr($f_fecha1,4,2);
    
$f_ni_dd1    = substr($f_fecha1,6,2);

    
$f_contacto   = $row["cer_nomcon"];
    
$f_mail       = $row["cer_mailcon"];
    
$f_fono       = $row["cer_foncon"];
    
$f_proyecto   = $row["cer_proyecto"];
    
$f_valida     = $row["cer_numveri"];
    
$f_inspector  = $row["cer_inspector"];
    
$f_autoriza   = $row["cer_mandante"];
    
$f_observ      = $row["cer_observ"];    
    
    
    
$f_expire     = $row["cer_expire"];
    
$ano    = substr($f_expire,0,4);
    
$mes    = substr($f_expire,4,2);
    
$dia    = substr($f_expire,6,2);


    
$f_digitx     = $session["name"];

    






        
$result= ("select * from am_examen2 where ex_tipo = '$ar_equcer' order by RAND() limit 25"); 
        
$exa     = db_query($result) or die(db_error());
        
$row=db_fetch_array($exa);
        
        
$f_tipo    = $row["ex_tipo"];
        
$f_pregunta    = $row["ex_pregunta"];
        
$f_alter1    = $row["ex_alter1"];
        
$f_alter2    = $row["ex_alter2"];
        
$f_alter3    = $row["ex_alter3"];
        
$f_alter4    = $row["ex_alter4"];
        
$f_correcta    = $row["ex_correcta"];

//Inicio Impresion Informe

$im      = imagecreatefromPng("imagen.png"); 
$black   = ImageColorAllocate($im, 0, 0, 0);

/* Encabezado Informe*/
/* Encabezado Informe*/
/*     Cierre de encabezado */
/*  ----  Ingreso de datos en duro -----  */
//exa_respuesta[".$i."]      


while($row=mysql_fetch_row($result))
{ 


/*     Inicio  de   cuerpo*/
ImageString($im, 3, 100, 170, $f_pregunta[0], $black); // Pregunta 1
ImageString($im, 3, 100, 190, $f_pregunta[1], $black); // Pregunta 2
ImageString($im, 3, 100, 210, $f_pregunta[2], $black); // Pregunta 3
ImageString($im, 3, 100, 230, $f_pregunta[3], $black); // Pregunta 4

}



//Finalizando Impresión
ImagePng($im);

?>