2017-04-06 118 views
0

尝试使用笨,以显示TCPDF的画面时,我有一个问题,无法获取图像(笨,TCPDF,PHP)的大小

这是我的PDF查看:

$base_url=base_url(); 

// NON-BREAKING ROWS (nobr="true") 

$tbleauproduct = <<<EOD 
<br /><br /><br /> 
<table border="1" align="center"> 
    <tr> 
     <th>picture</th> 
     <th>Product name</th> 
     <th>Price</th> 
     <th>Quantity</th> 
    </tr> 
    <tr> 
     <td><img src="$base_url/assets/$picture" /></td> 
     <td>$name</td> 
     <td>$price</td> 
     <td>$qty</td> 
    </tr> 
</table> 
EOD; 

$pdf->writeHTML($tbleauproduct, true, false, true, false, ''); 

和这是结果:

TCPDF ERROR: [Image] Unable to get the size of the image: http://localhost:8888/open_bay//assets/130501153059-htc-one-1024x576.jpeg 
+0

PDF不是图像。 – Narf

+0

可能重复的[TCPDF错误:无法获取图像的大小](http://stackoverflow.com/questions/27060947/tcpdf-error-unable-to-get-the-size-of-the-image) –

+0

避免张贴图像的代码。始终将代码作为文本发布。我已经替换了你的图片。 – mickmackusa

回答

0
$file_path = base_url().'assets/130501153059-htc-one-1024x576.jpeg'; 
$size = filesize($file_path); 
+0

我使用这种方法,但我发现这个问题:消息:文件大小():stat失败http:// localhost:8888/open_bay/assets/130501153059-htc-one-1024x576.jpeg –

+1

仅有代码的答案可以通过改进提供解释或可能链接到官方文件。答案不仅帮助OP解决问题,而且帮助未来的SO研究人员快速解决问题。让每个帖子都可以达到最高质量,并且您可以站得更高,从upvotes获得更多的rep点。 – mickmackusa