2016-05-13 78 views
0

我有一个问题。我写的显示从MySQL数据库图像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(); 
?> 

如何可以在垂直形式显示我的图片重叠?

请任何人都可以帮助我。

回答

0

documentation我可以看到Image方法取坐标为[x, y]。因此,只要对每个图像计算新的位置:

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

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

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

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

+0

谢谢你这么多。 –

1

问题是与线

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

的第一属性是 “文件”,第二个是X轴的位置,第三个是Y轴,第四个是宽度。

REFFERENCE:Documentation

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

相关问题