I'm stuck in very awkward situation where Images are being shown in Local Environment while generating PDF. But, Not in Production. Images being displayed as [X] when to generate PDFs with mPDF.
After inserting $mpdf->showImageErrors = true;
in Controller.
public function actionExportCasesPdf($id) {
.
.
.
.
$mpdf = new \mPDF();
$mpdf->showImageErrors = true;
$mpdf->WriteHTML($output);
$mpdf->Output($fileName, 'D');
}
Error
MpdfException
IMAGE Error (..17.jpg): Error parsing image file - image type not recognised, and not supported by GD imagecreate
Even, GD library is installed in the server using apt-get install php5-gd
command. And, Image Path are also used correct.
I tried to keep image source as such. But, No Luck.
<img src="<?= \yii\helpers\Url::to('@web/images/logo.png', true) ?>" width="100" alt="logo" />
I searched and tried the solution given by these links. But, still no luck :
- Images not showing on production but they do on local environment - GitHub
- mPDF 5.7.1 - image displays as a broken [x]
- Generated picture in mpdf
- Error parsing image file
Any help/hint/suggestion is appreciable.