Troubleshooting TCPDF ERROR: [Image] Unable to get the size of the image

Symptom

When downloading a PDF copy of a client's invoice after customizing the invoicepdf.tpl template file, you may encounter a TCPDF ERROR message:

TCPDF ERROR: [Image] Unable to get the size of the image: https://www.example.com/images/image-name.png
Click to copy

Cause

This error indicates that your server cannot use the cURL library function to load the logo image for inclusion in the PDF invoice. This could be due to a firewall configuration or similar security measures on the server or network.

To troubleshoot this issue:

  1. SSH in to your WHMCS installation's server.
  2. Execute the following command, replacing https://www.example.com/images/image-name.png with the URL of the logo image in the error message:
curl -v https://www.example.com/images/image-name.png
Click to copy

A successful result will include a 200 HTTP response code. For example:

* Connection state changed (MAX_CONCURRENT_STREAMS == 100)!
< HTTP/2 200 
< date: Mon, 04 Oct 2021 10:01:22 GMT
< server: Apache/2
< last-modified: Mon, 29 Mar 2021 06:02:17 GMT
< etag: "42e6-5bea69fba6425"
< accept-ranges: bytes
< content-length: 17126
< cache-control: max-age=259200
< expires: Thu, 07 Oct 2021 10:01:22 GMT
< content-type: image/png
Click to copy

Resolution

Work with your system administrator or hosting provider to resolve any errors that the cURL test produces.

or

Adjust the customizations in the invoicepdf.tpl template file to use the relative path to the image instead of the full URL.