0

I have a problem when trying to show picture in tcpdf using codeigniter,

This is my pdf view:

$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, '');

and this is the result:

TCPDF ERROR: [Image] Unable to get the size of the image: http://localhost:8888/open_bay//assets/130501153059-htc-one-1024x576.jpeg
mickmackusa
  • 43,625
  • 12
  • 83
  • 136
Hamza Najemi
  • 243
  • 3
  • 9
  • 15

1 Answers1

0
$file_path = base_url().'assets/130501153059-htc-one-1024x576.jpeg';
$size = filesize($file_path);
mickmackusa
  • 43,625
  • 12
  • 83
  • 136
  • I use this method but I found this problem : Message: filesize(): stat failed for http://localhost:8888/open_bay/assets/130501153059-htc-one-1024x576.jpeg – Hamza Najemi Apr 07 '17 at 09:39
  • 1
    Code-only answers can be improved by supplying an explanation or perhaps links to official documentation. Answers don't just help the OP to resolve an issue, they help future SO researchers to quickly solve their issues. Make every post the highest quality that you can and you will stand to gain more rep points from upvotes. – mickmackusa Apr 09 '17 at 22:19