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 :

  1. images not showing on production on local environment - github
  2. mpdf 5.7.1 - image displays broken [x]
  3. generated picture in mpdf
  4. 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

Popular posts from this blog

serialization - Convert Any type in scala to Array[Byte] and back -

matplotlib support failed in PyCharm on OSX -

python - Matplotlib: TypeError: 'AxesSubplot' object is not callable -