Support » Plugin: WooCommerce Gift Coupon » Images not showing on PDF

  • Resolved andantesash

    (@andantesash)


    How do I fix the issue of no images appearing in the PDFs that are sent?

    Any issues I add to the pdf appear with a grey box and a cross through it saying “image not found, or type not found”

    How do I fix this?

Viewing 15 replies - 1 through 15 (of 19 total)
  • Steve

    (@steveschmutzler)

    Hi andantesash,

    U can fix it by changing woocommerce-gift-coupon/includes/mail.php Line 392

    $dompdf = new Dompdf();
    $dompdf->set_option('isRemoteEnabled', TRUE);
    $dompdf->setPaper( 'A4', 'portrait' );

    Nice greets

    Steve

    • This reply was modified 8 months ago by  Steve.

    Steve, tried this. Didn’t help.
    I use a regular JPG image. PDF keeps saying “image not found or type unknown.”
    Cheers,
    Peter

    Hi Guys,

    I managed to solve this by turning the image into BASE64 code and including it into the PDF.

    What I have done (all changes are in file mail-template.php):
    – I added this code to load the image into base64:

    $woocommerce_gift_coupon_logo_type = pathinfo($woocommerce_gift_coupon_logo, PATHINFO_EXTENSION);
    $woocommerce_gift_coupon_logo_data = file_get_contents($woocommerce_gift_coupon_logo);
    $woocommerce_gift_coupon_logo_base64 = 'data:image/' . $woocommerce_gift_coupon_logo_type . ';base64,' . base64_encode($woocommerce_gift_coupon_logo_data);
    

    Then I updated the image rendering by deleting

    $email .= '<img src="' . $woocommerce_gift_coupon_logo . '" width="190" />';

    and adding this instead

    $email .= '<img src="' . $woocommerce_gift_coupon_logo_base64 . '" width="190" />';

    I hope this helps someone else than me 😉

    • This reply was modified 7 months, 1 week ago by  Dezzy. Reason: Styling

    How does it work, updating the image rendering? Were do i put that code?

    • This reply was modified 7 months, 1 week ago by  robbie2505.
    Plugin Author Alberto Perez

    (@studiosweb)

    We review that as soon as possible,

    Thanks

    Hey and Thank You for the cool plugin. I have the same issue – tryed differend image types – none of them works.

    Same here, no image type works (jpg, gif, bmp, pdf, svg, png) and although I thank @dezzy for attempting to post a solution, the explanation itself assumes that you
    a) know how to convert an image into BASE64 and…
    b) know where the ‘pdf’ is and how to insert the raw data into it.

    Other than that, good job. Is this likely to be an easy fix? Did it work before?

    Many thanks for providing this free though, a little more work and many people would be happy to pay for it.

    Plugin Author Alberto Perez

    (@studiosweb)

    Hi everybody, thanks a lot for your good opinions.

    I am reviwing de code, in our testing, the image was added succesfully to the PDF, i dont know if you can provide me your image to test it.

    I am so happy to help you because people somentimes reconize my work with donations.

    Plugin Author Alberto Perez

    (@studiosweb)

    i’ll test base64 on img.

    I let you know my advance of this issue as soon as possible.

    Best regards

    Perhaps an option to use an image from the media library, rather than uploading an image, would be a better option?

    • This reply was modified 4 months, 1 week ago by  dmullerdesign.
    • This reply was modified 4 months, 1 week ago by  dmullerdesign.
    Plugin Author Alberto Perez

    (@studiosweb)

    Hi @dmullerdesign

    I am debugging the code to fix this issue on the next upgrade.

    Regards,

    Plugin Author Alberto Perez

    (@studiosweb)

    Dear all,

    This issue has been resolved, please, upgrade to version: 3.2.7 and let me know if your problem with the image has been resolved to mark this issue as closed.

    Thanks a lot.

    Best regards,

    toolsnz

    (@toolsnz)

    I am having the same issue with images even after upgrading to 3.2.7.
    Both with the logo, and in body of pdf.

    Can you perhaps post the image you are using for testing?
    Maybe we can eliminate the image(s) as the issue?

    Thanks for your efforts.

    Plugin Author Alberto Perez

    (@studiosweb)

    Hi @toolsnz

    We test with a JPG image. It is converted on base64 and after this is included directly on the code. For me its works right.

    Can you provide me your image?

    toolsnz

    (@toolsnz)

    Hi Alberto,

    … I think I misunderstand what I should be doing here.
    for the ignorant (me) can you please give me some steps/exmaple for ‘including directly in code’

Viewing 15 replies - 1 through 15 (of 19 total)
  • You must be logged in to reply to this topic.