show image in a cell (cell) fpdf

0

Greetings friends I have a problem I'm making a query and all is well the problem is how to picture the image inside a cell in pdfpf since it shows me everything unbalanced, the code that I implement is the following:

<?php
require('../pdf/fpdf.php');
require('../conexion/conexion.php');
$pdf =& new FPDF('P', 'mm', 'letter'); //para que la hoja sea tipo carta
$pdf->AddPage('P','letter'); //para que la hoja sea tipo carta
$pdf->Image('../cintillo/cintillo.png',10,8,120);
$pdf->Ln(40);
$pdf->SetFont('Arial', 'B', 20, 'C');
$pdf->Cell(190, 8, utf8_decode ('Listado General Galerías'), 10,8, 'C');
$pdf->Ln(5);
$pdf->SetFillColor(2,157,116);//Fondo verde de celda
$pdf->SetTextColor(3, 3, 3); //Letra color blanco
$pdf->SetFont('Arial', 'B', 9);
$pdf->Cell(10, 5, utf8_decode ('Cód.'), 1,0,'C','R');
$pdf->Cell(60, 5, utf8_decode ('Título'), 1,0,'C','R');
$pdf->Cell(100, 5, utf8_decode ('Imagen'), 1,0,'C','R');
$pdf->Ln(5);
$pdf->SetFont('Arial', '', 9);


$sql = "SELECT * FROM galerias ORDER BY id";
$result=mysql_query($sql,$link);//devuelve la consulta
$i=1;

while($row =mysql_fetch_array($result)) 
{ 
$pdf->Cell(10, 5, $i, 1,0,'C','R');
$pdf->Cell(60, 5,$row['titulo'], 1,0,'C');
$pdf->Cell(100,5, $pdf->Image('../galerias/'.$row['portada'], $pdf->GetX()+40, $pdf->GetY()+3, 30), 1,0,'C');
$pdf->Ln();
$i++; 
} 


$pdf->SetY(10);

$pdf->AliasNbPages();


$pdf->Ln(8);

$pdf->SetFont('Arial', 'B', 8);
$pdf->Cell(114,8,'',0);
for($i=1;$i<=40;$i++)
$pdf->Output('Reporte General Galerias.pdf', 'I');
?>

    
asked by yoclens 11.03.2017 в 19:11
source

2 answers

1

You have tried this way

$pdf->Cell(11,11, $pdf->Image('images/prueba.jpg', $pdf->GetX(), $pdf->GetY(),11),1);

I hope it works for you

    
answered by 11.03.2017 / 23:59
source
1
$pdf->Cell(15,15, $pdf->Image("prueba/".$data['imagen'], $pdf->GetX(), $pdf->GetY(),15,15),1); 

it worked for me

    
answered by 03.08.2018 в 10:22