Jump to content


Photo

Exibir Imagem Do Bd Em Campo Blob Em Um Pdf!


  • Faça o login para participar
1 reply to this topic

#1 xulapa4fun

xulapa4fun

    Novato no fórum

  • Usuários
  • 18 posts
  • Sexo:Não informado

Posted 06/02/2007, 10:56

Ae galera!

Precizo exibir uma imagem q está armazenada no BD em campo BLOB.

Pra isso, fiz o seguinte:

<?php
define('FPDF_FONTPATH', 'fpdf/font/');
require_once('fpdf/fpdf.php');
//---- [ CONFIGURE ABAIXO ] ----------------------------------------------------------------------
$host = "localhost"; // servidor
$ux = "root"; // usuario do bd
$senx = "root"; // senha do bd
$bdx = "tabela"; // bd
//---[ NÃO ALTERE NADA ABAIXO ] ------------------------------------------------------------------
$coneccao = mysql_connect($host , $ux , $senx ) or die ("Erro ao se conectar ao mysql ... ");
$coneccao_bd = mysql_select_db($bdx)or die ("Erro ao se conectar a base de dados ... ");

$pdf = new FPDF('p','mm',array('215.9','279.9'));
$pdf->Open();
$pdf->AddPage();
$pdf->SetAutoPageBreak(true,0);

$busca = mysql_query("SELECT * FROM tba order by id LIMIT 8"); $n=1;
while($row = mysql_fetch_array($busca)){
$data_nasc = explode("-","$row[datan]");
$data_nasc = $data_nasc[2]."/".$data_nasc[1]."/".$data_nasc[0];


if( ($n == 1) ){
$foto1 = mysql_query("SELECT * FROM tbb numero='$row[cod_barra]'");
$row1 = mysql_fetch_array($foto1); //linha 26


$pdf->SetFont("Arial", "", 9);
$pdf->SetXY(3,3);
$pdf->Cell(0,0, "".$row['id']." $n");

$pdf->Image("$row1[imagem]",'20','31.4',42,10);
$pdf->SetXY(50,40.1);
$pdf->SetFont('Arial','B',7);
$pdf->Cell(0,0, "-1");

$pdf->SetFont('Arial','',9);
$pdf->SetXY(22,47);
$pdf->Cell(0,0, "$data_nasc");
$pdf->SetXY(18,58);
$pdf->Cell(0,0, "".$row['nome']."");


}

$n++;}
$pdf->Output();
?>



da o seguinte erro:


Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in c:\windows\serv-n\www\umespa\imprime.php on line 26
FPDF error: Image file has no extension and no type was specified:

ai tentei por:

header("Content-type: image/x-png");

mas ai aparece o famoso Warning: Cannot modify header information - headers already sent by

oq fazer ????????

#2 Dantes

Dantes

    Turista

  • Usuários
  • 29 posts
  • Sexo:Não informado

Posted 06/02/2007, 20:35

nao falto um WHERE ali no
$foto1 = mysql_query("SELECT * FROM tbb ?AKI? numero='$row[cod_barra]'");




1 user(s) are reading this topic

0 membro(s), 1 visitante(s) e 0 membros anônimo(s)

IPB Skin By Virteq