0

I'm working on an FPDF project. I've made an HTML/PHP form where you can upload multiple images... now I want them to show in my FPDF.

This is the code that I've now:

$pdf->AddPage();

$query1 = "SELECT filename FROM `file_upload` WHERE ncrnummer = '$ncrnummer'";
$result1 = mysqli_query($conn, $query1);

while ($row = mysqli_fetch_assoc($result1)) {
    $image = $row['filename'];
    $pdf->Image("images/".$image,11,11,90,75, "");
    $pdf->Cell(47.5, 10, "", 0, 1); 
}

$pdfdoc = $pdf->Output('', 'S');

At this moment it looks like the images are placed over each other...

Is there somebody that knows how to fix this (small) problem?

Armali
  • 18,255
  • 14
  • 57
  • 171
Rob
  • 13
  • 5
  • You are passing x and y coordinates to `Image()`. I'd guess you'd have to pass `null` there, so that the current position is used, if you want automatic distribution across the page. Or you could calculate the coordinates from the image number times the offset you want them to have. – Karsten Koop Oct 16 '18 at 11:03
  • Do you have an example of that X and Y coordinates? – Rob Oct 16 '18 at 13:15
  • Also, I'm printing like 6 images on my PDF page......is that also possible? – Rob Oct 16 '18 at 13:16
  • What do you mean? According to [the documentation](http://www.fpdf.org/en/doc/image.htm), you are passing 11 for both x and y. Try using null instead. – Karsten Koop Oct 16 '18 at 13:16
  • Surely 6 images are possible, if they are smaller than 1/6th of a page – Karsten Koop Oct 16 '18 at 13:17

0 Answers0