sazr
sazr

Reputation: 25928

mPDF error: Could not find image file

When generating a PDF using mpdf I get the error:

mPDF error: IMAGE Error (https://mywebsite.com/images/foo.png): Could not find image file

This post says that its a internal domain resolution error. I know its an internal server domain resolution issue because if I place that above image url into my browser the image appears.

So I have done the advice in the above post and added my domain to /etc/hosts but it still doesn't work.

What do I need to configure on my Cent OS 6.8 VPS to resolve these urls internally? Maybe I need to restart some services on the server to enable the change?. My server is with GoDaddy and all of the below was already in the file. I just added mywebsite.com to 127.0.0.1.

127.0.0.1               localhost.localdomain localhost mywebsite.com
::1             localhost localhost.localdomain localhost6 localhost6.localdomain6
XX.XX.XXX.222           mywebsite.com sXXX-XXX-XX-71.secureserver.net sXXX-XXX-XX-71 ip-XX-XX-XXX-222.ip.secureserver.net ip-XX-XX-XXX-222
XXX.XXX.XX.71           mywebsite.com

For context; The PDF is built from a HTML template that has images in it. The image urls are in the format src="/images/foo.png".

Upvotes: 3

Views: 2392

Answers (1)

Stan Fad
Stan Fad

Reputation: 1234

use src="image/foo.png" instead of src="/image/foo.png" helped me

Upvotes: 3

Related Questions