TCPDF:图像未正确显示在 PDF 中

TCPDF: Images aren't showing in PDF properly

好的,我有一个代码可以在同一个表单上显示图像

Like formid=7 有两张图片,当我 运行 在网页上进行相同的查询时它会同时显示。但是,当我在 PDF (TCPDF) 中应用相同内容时,它只显示一张图片,我不知道为什么

代码:

 if (isset($_POST['submits'])){
 require_once 'includes/practice.php'; 
 $pdf->SetFont('times', '', 10);
​ ​​$pdf->SetFont('aealarabiya', '', 12);
​ //$pdf->SetTopMargin(5);
​ //$pdf->AddPage('L','A4');
​ include('connect.php');
​ $emp_number=$_POST['emp_number'];
​ $formid=$_POST['formid'];
​ //$image='<span><div> <h2>Shop Images:</h2></div>';
​ //$getFiles = "SELECT * FROM inspection_files where formid=$formid";
​ $getFiles = $link->query("SELECT * FROM inspection_files WHERE formid=$formid");
​ if($getFiles->num_rows > 0){
​ while($row = $getFiles->fetch_assoc()) {
​ ​   $imageURL = 'images/'.$row["file_name"];
​    $images='<img src="'.$imageURL.'" width="150" />';
​   }
​ } else {
​  echo '<p>No image(s) found...</p>';
​ }

在 HTML 的某个地方,我请求 formid 喜欢 $_REQUEST['formid'];

我认为您的 $images 变量在每个循环步骤中都被覆盖了。

尝试在 while 循环中更改此行

$images='<img src="'.$imageURL.'" width="150" />';

到这个

$images.='<img src="'.$imageURL.'" width="150" />';