TCPDF
TCPDF copied to clipboard
Images from server with self signed certificate are not added
In a dev environment where obviously I only use a self signed certificate and PHP that works with it this way
//Allow self signed certificate
$fgOptions = array(
"ssl" => array(
"verify_peer" => false,
"verify_peer_name" => false,
)
);
$html = file_get_contents($urlTpl, false, stream_context_create($fgOptions));
it happens that (I simplify a lot showing only the important parts)
$pdf->writeHTML($html, true, false, false, false, '');
$pdf->Output("Cod_$gid.pdf", 'I');
opens the pdf showing data but not images. No problem with a real certificate online. No problem using http instead of https.
Here the important part
If instead of writeHTML() I use a simpler
echo $html;
the pdf, despite a bit of a mess, it really shows the images.
So the problem it's somewhere in writeHTML() or the Output() function.
One way to circumvent the problem is to change the $html content on the fly renaming https into http so that the images, but would be better if it worked without a workaround.