我正在从mysql数据库中检索我的图像并使用 FPDF.My 打印到我的PDF,问题是我希望我的MemImages从左到右在一行中,而不是彼此下方,以节省打印时的空间。你能帮忙吗,提前谢谢你。我的代码如下。
$resultImage = mysql_query("SELECT * FROM DBImage WHERE projectSectionId = '$projectSectionId' AND userId = '$userId' AND date = '$date' AND time = '$time'");
while($runImage = mysql_fetch_assoc($resultImage))
{
$image = $runImage['image'];
if(empty($image)){
} else {
$pdf->Ln(2);
$pdf->MemImage($image);
$pdf->Ln(2);
}
}
我终于得到了答案,并解雇了另一位将面临相同问题的开发人员。这是我在下面的答案。
$resultImage = mysql_query("SELECT * FROM DBImage WHERE projectSectionId = '$projectSectionId' AND userId = '$userId' AND date = '$date' AND time = '$time'");
while($runImage = mysql_fetch_assoc($resultImage))
{
$array[] =$runImage;
$image = $runImage['image'];
$image_height = 45;
$image_width = 60;
//get current X and Y
$start_x = $pdf->GetX();
$start_y = $pdf->GetY();
if(empty($image)){
}else{
// place image and move cursor to proper place. "+ 2" added for buffer
$pdf->MemImage($runImage['image'],$pdf->GetX(), $pdf->GetY(),$image_width,$image_height);
$pdf->SetXY($start_x + $image_width + 2, $start_y);
}
}