I am getting the same problem as TCPDF don't display image with writeHTML. Everything works just fine in my localhost server, but the images is not showing up when deployed to the live server.
I have tried the following steps:
- The images are in base64, so it's nothing to do with the path or file permission. I printed out the base64 string and pretty sure it's normal.
- Both png and jpeg format don't work
- Both TCPDF Image() and writeHTML() with don't work
- The quote mark is
'<img src="..." />'
instead of"<img src='...' />"
- Adding width and height doesn't work.
Here is the code:
// $data is the base64 string
$data = base64_decode($scoreImg);
$pdf->Image('@'.$data); // this doesn't work
$html = '<img src="data:image/jpeg;base64,' . $scoreImg . '" width="50" height="50">';
$pdf->writeHTMLCell(0, 0, '', '', $html, 0, 1, 0, true, '', true); // this doesn't work as well
Anyone please save my day.