2016-05-13 80 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值,以防止重疊

相關問題