TCPDF Image Size Errors

Problem

When downloading a PDF invoice or quote (for example, during the daily automation cron tasks), you encounter a TCPDF error message:

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

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.

Troubleshooting

To troubleshoot this issue:

  1. SSH in to your WHMCS installation’s server.

  2. Run 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

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

Solution

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.

Last modified: May 28, 2024