Foros del Web » Programando para Internet » PHP »

Mostrar imagen guardada en mysql con dompdf

Estas en el tema de Mostrar imagen guardada en mysql con dompdf en el foro de PHP en Foros del Web. Hola que tal. Miren lo que trato de hacer es una pagina de futbol en la cual el usuario busque a un jugador y una ...
  #1 (permalink)  
Antiguo 28/09/2012, 21:58
 
Fecha de Ingreso: mayo-2012
Ubicación: Distrito Federal
Mensajes: 49
Antigüedad: 11 años, 10 meses
Puntos: 9
Pregunta Mostrar imagen guardada en mysql con dompdf

Hola que tal.

Miren lo que trato de hacer es una pagina de futbol en la cual el usuario busque a un jugador y una vez mostrados los resultados obtenidos de una base de datos mysql este pueda generar una ficha del resultado en formato pdf al oprimir un boton. Para ello utilizo la libreria dompdf

Mi problema aparece al tratar de generar el reporte y que en este aparesca la foto del jugador la cual esta en la base de datos. El problema es simplemente con la imagen, ya que sino agrego esta a la hora de generar el reporte, este se crea sin ningun problema.

Al principio la imagen la mostraba por medio de una imagen dinamica, pero me di cuenta que los resultados para el pdf los estoy obteniendo por medio de '.$_POST["nombre"].' y al no ser esta un campo de formulario, decidi mostrarla ahora en un campo de imagen para asi poder pasar los valores por medio de POST, pero mi sorpresa fue que a la hora de generar el pdf este no se hacia.

Como les digo si quito la parte para mostrar la imagen el pdf si se crea correctamente tomando los demas valores de la busqueda.

Aqui les dejo el codigo que toma los valores del formulario y genera el pdf. Esperando que me puedan decir como tomar el valor del formulario y que el pdf se haga sin problemas, ya sea mostrando la imagen en un campo de imagen o como una imagen dinamica

Código PHP:
    <?php 
    
    
require_once("dompdf/dompdf_config.inc.php");
    
    
$conexion mysql_connect("localhost""usuario""pass");

    
mysql_select_db("sistema"$conexion);


$html ='

<html>
<head>
<title>Ficha Tecnica</title>
<style type="text/css">
<!--
#datos {
    position:absolute;
    width:780px;
    left: 164px;
    top: 316px;
    text-align: center;
}
#apDiv1 #form1 table tr td {
    text-align: center;
    font-weight: bold;
}
#apDiv2 {
    position:absolute;
    width:49px;
    height:45px;
    z-index:2;
    left: 12px;
    top: 11px;
}
#apDiv1 #notificacion table tr td {
    text-align: center;
}
#apDiv1 #notificacion table tr td {
    text-align: left;
}
#apDiv1 #notificacion table tr td {
    text-align: center;
    font-family: Arial, Helvetica, sans-serif;
}
#apDiv3 {
    position:absolute;
    width:814px;
    height:115px;
    z-index:1;
    left: 34px;
    text-align: center;
    top: 11px;
}
-->
</style>
</head>

<body>
<div id="apDiv3">
  <table width="81%" border="1" cellpadding="0" cellspacing="0" bordercolor="#000000">
    <tr>
      <td><table width="100%" border="0">
        <tr>
          <td style="text-align: center"><img src="imagenes/logo_soccer.jpg" alt="" width="370" height="256"></td>
        </tr>
        <tr>
          <td><p>&nbsp;</p>
            <p style="font-family: Helvetica LT Condensed; color: #06F; font-weight: bold; font-size: 22px; text-align: center;">FICHA TECNICA</p></td>
        </tr>
        <tr>
          <td>&nbsp;</td>
        </tr>
        <tr>
          <td style="font-family: Helvetica LT Condensed; font-size: 18px;"><spanHelvetica LT Condensed"; font-size: 18px;">
            <span style="font-family: Arial, Helvetica, sans-serif; font-size: 20px; font-weight: bold; color: #06F;">Nombre: <span style="color: #000; font-weight: normal;">'
.$_POST["nombre"].'</span></span></td>
        </tr>
        <tr>
          <td style="font-family: Helvetica LT Condensed; font-size: 18px;"><span style="font-family: Arial, Helvetica, sans-serif; font-size: 20px; color: #06F; font-weight: bold;">Edad:</span> <span style="color: #000; font-family: Arial, Helvetica, sans-serif; font-size: 20px;">'
.$_POST["edad"].' A&ntilde;os</span></td>
        </tr>
        <tr>
          <td style="font-family: Helvetica LT Condensed; font-size: 18px;"><span style="font-family: Arial, Helvetica, sans-serif; font-size: 20px; color: #06F; font-weight: bold;">Altura:</span> <span style="color: #000; font-family: Arial, Helvetica, sans-serif; font-size: 20px;">'
.$_POST["altura"].' m</span></td>
        </tr>
        <tr>
          <td style="font-family: Helvetica LT Condensed; font-size: 18px;"><span style="font-family: Arial, Helvetica, sans-serif; font-size: 20px; color: #06F; font-weight: bold;">Peso:</span> <span style="font-family: Arial, Helvetica, sans-serif; font-size: 20px;">'
.$_POST["peso"].' Kg.</span></td>
        </tr>
        <tr>
          <td style="font-family: Helvetica LT Condensed; font-size: 18px;"><span style="font-family: Arial, Helvetica, sans-serif; font-size: 20px; color: #06F; font-weight: bold;">Pais:</span> <span style="font-family: Arial, Helvetica, sans-serif; font-size: 20px;">'
.$_POST["nacionalidad"].'</span></td>
        </tr>
        <tr>
          <td style="font-family: Helvetica LT Condensed; font-size: 18px;"><span style="font-family: Arial, Helvetica, sans-serif; font-size: 20px; color: #06F; font-weight: bold;">Numero:</span> <span style="font-family: Arial, Helvetica, sans-serif; font-size: 20px;">'
.$_POST["numero"].'</span></td>
        </tr>
        <tr>
          <td style="font-family: Helvetica LT Condensed; font-size: 18px;"><span style="color: #06F; font-family: Arial, Helvetica, sans-serif; font-size: 20px; font-weight: bold;">Posicion:</span> <span style="font-family: Arial, Helvetica, sans-serif; font-size: 20px;">'
.$_POST["posicion"].'</span></td>
        </tr>
        <tr>
          <td style="font-family: Helvetica LT Condensed; font-size: 18px;"><span style="color: #06F; font-weight: bold; font-family: Arial, Helvetica, sans-serif; font-size: 20px;">Apodo:</span> <span style="font-family: Arial, Helvetica, sans-serif; font-size: 20px;">'
.$_POST["apodo"].'</span></td>
        </tr>
        <tr>
          <td style="font-family: Helvetica LT Condensed; font-size: 18px;"><span style="color: #06F; font-family: Arial, Helvetica, sans-serif; font-size: 20px; font-weight: bold;">Habilidad:</span> <span style="font-family: Arial, Helvetica, sans-serif; font-size: 20px;">'
.$_POST["habilidad"].'</span></td>
        </tr>
        <tr>
          <td><p>&nbsp;</p>
            <p><span style="color: #06F; font-family: Arial, Helvetica, sans-serif; font-size: 20px; font-weight: bold;">Comentarios:</span> <span style="font-family: Arial, Helvetica, sans-serif; font-size: 20px;">'
.$_POST["comentarios"].'</span></p>
            
************ SI QUITAN ESTA PARTE LA CONVERSION SE HACE SIN NINGUN PROBLEMA*********

            <p><span style="color: #06F; font-family: Arial, Helvetica, sans-serif; font-size: 20px; font-weight: bold;">Imagen:</span> <span style="font-family: Arial, Helvetica, sans-serif; font-size: 20px;">'
.$_POST["imagen"].'</span></span></p>

*****************************************************************

            <p>&nbsp;</p></td>
        </tr>
        <tr>
          <td>&nbsp;</td>
        </tr>
      </table></td>
    </tr>
  </table>
</div>
</body>
</html>

'


    
$dompdf = new DOMPDF();
    
$dompdf->load_html($html);
    
$dompdf->render();
    
$dompdf->stream("Ficha_Tecnica.pdf", array('Attachment'=>'0'));
    
?>

Última edición por chuntaro18; 28/09/2012 a las 22:05

Etiquetas: dompdf, formulario, html, mysql, usuarios
Atención: Estás leyendo un tema que no tiene actividad desde hace más de 6 MESES, te recomendamos abrir un Nuevo tema en lugar de responder al actual.
Respuesta




La zona horaria es GMT -6. Ahora son las 09:43.