New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: prevent TCPDF image size error #3936

Open
kevinwhoffman opened this Issue Jan 10, 2019 · 3 comments

Comments

Projects
None yet
2 participants
@kevinwhoffman
Copy link
Member

kevinwhoffman commented Jan 10, 2019

Bug Report

User Story

As a user, I want to access various PDFs generated by Give core and its add-ons without errors so that I can actually see the contents of the PDF.

I'm creating this issue in Give core because TCPDF is part of Give core. However replicating the issue will require testing with the various add-ons described in Acceptance Criteria.

Current Behavior

Attempting to view some PDFs such as the Gift Aid Declaration Form results in the following white screen error:

TCPDF ERROR: [Image] Unable to get the size of the image: https://tempgiveemailnotice.test/wp-content/plugins/give-gift-aid/assets/images/place_holder.png

Expected Behavior

All PDFs generated by Give should work with default images or user-uploaded images.

Bug Type

  • This bug describes functionality that once worked as expected.
  • This bug describes functionality that never worked as expected.
  • I am not sure whether this functionality ever worked as expected.

Steps to Reproduce

  1. Install Give Core 2.4.0 and Gift Aid 1.2.0.
  2. Enable Gift Aid and make a donation opting into Gift Aid.
  3. View the donation details in WP admin and click Download Declaration Form to see the error. This error also occurs if the donor tries to view the PDF from the front-end receipt.

Visuals

This screencast shows the error when Give core and Gift Aid are active.
https://www.useloom.com/share/c1ce5cb92c9347918bcc40aa0ed3a6d3

Acceptance Criteria

  • Default and custom images work in PDF templates within Gift Aid add-on.
  • Default and custom images work in PDF templates within PDF Receipts add-on.
  • Default and custom images work in PDF templates within Annual Receipts add-on.
  • Default and custom images work in PDF templates within Tributes add-on.
@kevinwhoffman

This comment has been minimized.

Copy link
Member

kevinwhoffman commented Jan 10, 2019

@DevinWalker On a local site using https, when I attempt to replace the logo in the Gift Aid Declaration Form, I get a different PHP notice when I try to view the PDF:

image

I thought the mention of SSL might indicate that it's failing to verify the SSL certificate within a local environment. So I tried the same steps on a local site using http (no SSL certificate), and the PDF generated as expected.

This suggests TCPDF is failing because it is unable to validate the SSL certificate. This may explain why we see this error commonly in local development but have not seen customer reports of it. Live customer sites using https probably have a real SSL certificate that doesn't cause the same error as a local SSL certificate.

@DevinWalker

This comment has been minimized.

Copy link
Member

DevinWalker commented Jan 11, 2019

@kevinwhoffman I haven't run into that error but I did notice that when I update the logo, which it allows me to do, the images are not appearing at all in the PDF when served over https:

2019-01-10_17-22-12

2019-01-10_17-23-11

When served over http they display:

2019-01-10_17-31-01

@kevinwhoffman

This comment has been minimized.

Copy link
Member

kevinwhoffman commented Jan 14, 2019

@DevinWalker and I believe this issue is limited to local development on https sites that do not have a real, valid SSL certificate which causes TCPDF to throw errors. Iceboxing unless we see reports from other devs/users.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment