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

  • 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 4 replies - 1 through 4 (of 4 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 1 month 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 1 week, 1 day ago by  Dezzy. Reason: Styling

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

    • This reply was modified 6 days, 21 hours ago by  robbie2505.
Viewing 4 replies - 1 through 4 (of 4 total)
  • You must be logged in to reply to this topic.