php - MpdfException IMAGE Error () : Error parsing image file - Yii2 -
i'm stuck in awkward situation images being shown in local environment while generating pdf. but, not in production. images being displayed [x] when generate pdfs 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, , not supported gd imagecreate
even, gd library installed in server using apt-get install php5-gd
command. and, image path used correct.
i tried keep image source such. but, no luck.
<img src="<?= \yii\helpers\url::to('@web/images/logo.png', true) ?>" width="100" alt="logo" />
i searched , tried solution given these links. but, still no luck :
- images not showing on production on local environment - github
- mpdf 5.7.1 - image displays broken [x]
- generated picture in mpdf
- error parsing image file
any help/hint/suggestion appreciable.
most picture not available mpdf via generated url. let's try debug :) run following code on both local , prod environments
$imageurl = \yii\helpers\url::to('@web/images/logo.png', true); $image = file_get_contents($imageurl); echo (new \finfo())->buffer($image); // echo $image; // ^^ uncomment, if previous line echoed not image-related. // maybe, you've got 404 error
Comments
Post a Comment