FPDF mc table with image
FPDF mc table with image
I have trouble displaying image (or this time is photo) using mc table FPDF.
This is a little of my script:
$pdf=new PDF_MC_Table();
$pdf->SetWidths(array(30,10,30,230));
$pdf->SetAligns(array('L','L','L','C'));
$pdf->Row(array($name, $age, $gender, $photo));
$pdf->Output();
$photo
fill with location of image that I want to display in my PDF table.
$photo
The image does not show up at all, instead it shows text of that location
not show up at all, instead its show text of that location
– Hendri P
Jul 20 at 15:04
hmm, do you have the
gd
extension installed? According to the docs here, that extension is required when working with images...– War10ck
Jul 20 at 15:40
gd
I use local drive and use mc table from this fpdf.org/?go=script&id=3
– Hendri P
Jul 21 at 0:09
The question is about
gd extension
. Is it installed?– Bharata
2 days ago
gd extension
1 Answer
1
I already got the answer
in mc_table.php I add this
...
function Row($data)
{
...
for($i=0;$i<count($data);$i++)
{
...
if(substr($data[$i],-3) == 'jpg' || substr($data[$i],-3) == 'png')
{
$ih = $h - 0.5;
$iw = $w - 0.5;
$ix = $x + 0.25;
$iy = $y + 0.25;
//show image
$this->MultiCell($w,5,$this->Image ($data[$i],$ix,$iy,$iw),0,$a);
}else
{
//Print the text
$this->MultiCell($w,5,$data[$i],0,$a);
}
...
}
}
By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.
What is the "trouble" that you're experiencing? Does the image not show up, is it too large, etc.?
– War10ck
Jul 20 at 14:48