4

i am facing below error while using mPDF(latest version) to show GIF extension image.
except gif all other extensions are supported.
Error :

mPDF error: IMAGE Error (tiger.gif): Error parsing temporary file image object created with GD library to parse GIF image

i tried many links provided by google regarding it, but they are not working.

any suggestions will be appreciated.
thanks.

Amit Joshi
  • 456
  • 1
  • 8
  • 21
  • 2
    We are facing the same issue, it is most probably due to PHP 7. And if you are not using PHP 7, you can try mPDF 6 with PHP <7 versions. Read this, https://github.com/mpdf/mpdf/issues/256 one guy resolve his issue by changing versions. – Sonal Khunt Jan 02 '18 at 12:36

6 Answers6

6

Same issue I am getting on aws server.

Mpdf is not allowed to get transparent image to generate PDF.

Make sure your image is not transparent. Try with non transparent image, it works for me.

This issues has been resolved in 6.1 version.

Kaushal Roy
  • 159
  • 1
  • 6
2

I have faced this issue, you probably using mPDF version 6

this issue has been fixed in version 6.1

this is the link page for mPDF v6.1.0

Version 6.1.0 released

For me I have downloaded 02-mPDF-v6.1.0-without-examples.zip

Then take backup for current mPDF folder

After that I have add version 6.1 and change the folder permission

And works fine :)

Also you can have a look for issue like that on githup

Error parsing image file - image type not recognised, and not supported by GD imagecreate #253

Ahmed Bermawy
  • 2,290
  • 4
  • 35
  • 42
2

I was facing the same error for PNG (transparent) images when I upgraded PHP version to 7.

After some debugging, I figured out that the error was triggered by the constant _MPDF_TEMP_PATH in mpdf.php file for some reason.

So, I renamed ALL the _MPDF_TEMP_PATH in the mpdf.php to a different one (unique) like _MPDF_TEMP_PATH_NEW.

Then, the images was showing like as before!

The versions I have are: PHP 7.2.22 | mPDF 5.7.3

I hope it helps!

giannis.epp
  • 1,489
  • 1
  • 11
  • 9
1

just change the permission of mpdf directory. it just can't create temp file in directory /tmp inside mpdf. it worked for me

0

I had the same issue, what helped was changing the image path from relative to absolute.

buzibuzi
  • 724
  • 3
  • 15
  • 27
0

I faced the same issue after we moved code to AWS Server.

After some debugging, I found the solution. We need to give write permissions to the mpdf/tmp directory.

After giving 0777 permission to mpdf/tmp directory, its working for me.

We don't need to give write permission to the whole mpdf directory. It may cause security issues.