无法获得图像的大小(codeigniter,tcpdf,php)

时间:2017-04-06 11:41:29

标签: php codeigniter codeigniter-2 codeigniter-3 tcpdf

尝试使用codeigniter

在tcpdf中显示图片时遇到问题

这是我的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

1 个答案:

答案 0 :(得分:0)

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