如何在不重叠的情况下显示来自 mysql 数据库的图像,FPDF?

How to display images from mysql database without overlapping, FPDF?

我有问题。我编写代码以显示 mysql 数据库中的图像到 FPDF,但图像显示为重叠(在相同位置)

<?php
include("connection.php");
$que1=mysql_query("select * from TableName);
ob_start();
require('fpdf/fpdf.php');
$pdf = new FPDF();
$pdf->AddPage(); 
while($rw=mysql_fetch_array($que1))
{
$profile=$rw['profile'];
$pdf->Image($profile,10,'',30);
}
$pdf->Output();
ob_end_flush(); 
?>

如何以垂直形式显示我的图像?

请任何人帮助我。

documentation 我可以看到图像方法采用 [x, y] 坐标。因此,只需为每张图片计算新位置:

$currentY = 0;
while ($rw = mysql_fetch_array()) {
    $imageSize = $this->getSize($rw['profile']);

    $pdf->Image($profile, 10, $currentY, 30);

    $currentY += $imageSize['height'];
}

尝试将 y 设置为空 - Image($profile, 10, null, 30)

问题出在行

$pdf->Image($profile,10,'',30);

第一个属性是"file",第二个是X轴位置,第三个是Y轴,第四个是宽度。

参考:Documentation

请提供不同的 x,y 值以防止重叠