Upgraded to version 2.3.1 images show up as broken links
-
I upgraded to the latest version of the plugin and the all the images and logo shows up broken please help
-
just did that and still not working sir is there a proper way to fix it?
Please this is a live website is there anyway to fix it?
Can you send the img tag from debug output again now? Last time your images were 404 not found.
Another thing you could try is copy the cart-table.php file into your child-theme/woocommerce/cart-pdf/cart-table.php. You can then customize the output of the PDF. Specifically you could try modifying this line, change
'woocommerce_thumbnail'
to'full'
, and see if that will work. That will resolve the issue if the thumbnails are not generating properly. Alternatively you could try replacing that wholeget_image()
method with your own code to retrieve the image. I would also test using other formats such as jpg or png to see if that is the issue, but I did test locally using some webp from your site and was able to render them on the PDF without issue.here’s the img tag again sir:
<a href=”https://courses.gastectraining.co.uk/shop/lpg-in-leisure-accomodation-vehicles/”><img width=”300″ height=”300″ src=”https://courses.gastectraining.co.uk/wp-content/uploads/2023/01/3b7aa090-8a51-4903-8ddf-d44ebcb86831-300×300.jpg” class=”attachment-woocommerce_thumbnail size-woocommerce_thumbnail” alt=”” decoding=”async” width=”60″ height=”auto” srcset=”https://courses.gastectraining.co.uk/wp-content/uploads/2023/01/3b7aa090-8a51-4903-8ddf-d44ebcb86831-300×300.jpg 300w, https://courses.gastectraining.co.uk/wp-content/uploads/2023/01/3b7aa090-8a51-4903-8ddf-d44ebcb86831-150×150.jpg 150w, https://courses.gastectraining.co.uk/wp-content/uploads/2023/01/3b7aa090-8a51-4903-8ddf-d44ebcb86831-768×768.jpg 768w, https://courses.gastectraining.co.uk/wp-content/uploads/2023/01/3b7aa090-8a51-4903-8ddf-d44ebcb86831-600×600.jpg 600w, https://courses.gastectraining.co.uk/wp-content/uploads/2023/01/3b7aa090-8a51-4903-8ddf-d44ebcb86831-100×100.jpg 100w, https://courses.gastectraining.co.uk/wp-content/uploads/2023/01/3b7aa090-8a51-4903-8ddf-d44ebcb86831.jpg 1024w” sizes=”(max-width: 300px) 100vw, 300px” /></a>and I also tried changing woocommerce thumbnail to full that also didn;t work and you said to use my own method of getting image well I don’t know how to do that sir
Do you see how what you pasted has a ” in the src URL? Do you know how that is getting there? Must be another plugin of sorts. I would try deactivating other plugins temporarily to see if that resolves the issue, or switching themes temporarily. You would want to do this on a staging environment as to not interrupt your live site.
I checked out everything and I guess there is an issue with the plugin it only happened with the altest update before everything was working fine so for a temporary solution I have disabled all product thumbnails using CArt-table.php file but I do want to show my company logo and to do that I just pasted the logo link directly in cart-table.php but still same problem can you tell me how to fix that so atleast I can display the logo.
THANK YOU!What is the output of the PDF when you add this to your functions.php?
add_filter( 'wc_cart_pdf_mpdf', function( $mpdf ) { $mpdf->showImageErrors = true; return $mpdf; } );
this is what I get when I run this code:
Fatal error: Uncaught Mpdf\MpdfImageException: Could not find image file (https://courses.gastectraining.co.uk/wp-content/uploads/2023/01/Logo_Main-Converted.png) in /home/customer/www/courses.gastectraining.co.uk/public_html/wp-content/plugins/wc-cart-pdf/vendor/mpdf/mpdf/src/Image/ImageProcessor.php:589 Stack trace: #0 /home/customer/www/courses.gastectraining.co.uk/public_html/wp-content/plugins/wc-cart-pdf/vendor/mpdf/mpdf/src/Image/ImageProcessor.php(211): Mpdf\Image\ImageProcessor->imageError(‘https://courses…’, true, ‘Could not find …’) #1 /home/customer/www/courses.gastectraining.co.uk/public_html/wp-content/plugins/wc-cart-pdf/vendor/mpdf/mpdf/src/Tag/Img.php(276): Mpdf\Image\ImageProcessor->getImage(‘https://courses…’, true, true, ‘https://courses…’, false) #2 /home/customer/www/courses.gastectraining.co.uk/public_html/wp-content/plugins/wc-cart-pdf/vendor/mpdf/mpdf/src/Tag.php(240): Mpdf\Tag\Img->open(Array, Array, 7) #3 /home/customer/www/courses.gastectraining.co.uk/public_html/wp-content/plugins/wc-cart-pdf/vendor/mpdf/mpdf/src/Mpdf.php(13850): Mpdf\Tag->OpenTag(‘IMG’, Array, Array, 7) #4 /home/customer/www/courses.gastectraining.co.uk/public_html/wp-content/plugins/wc-cart-pdf/wc-cart-pdf.php(186): Mpdf\Mpdf->WriteHTML(‘<div class=”wc_…’, 2) #5 /home/customer/www/courses.gastectraining.co.uk/public_html/wp-includes/class-wp-hook.php(310): wc_cart_pdf_process_download(”) #6 /home/customer/www/courses.gastectraining.co.uk/public_html/wp-includes/class-wp-hook.php(334): WP_Hook->apply_filters(NULL, Array) #7 /home/customer/www/courses.gastectraining.co.uk/public_html/wp-includes/plugin.php(517): WP_Hook->do_action(Array) #8 /home/customer/www/courses.gastectraining.co.uk/public_html/wp-includes/template-loader.php(13): do_action(‘template_redire…’) #9 /home/customer/www/courses.gastectraining.co.uk/public_html/wp-blog-header.php(19): require_once(‘/home/customer/…’) #10 /home/customer/www/courses.gastectraining.co.uk/public_html/index.php(17): require(‘/home/customer/…’) #11 {main} thrown in /home/customer/www/courses.gastectraining.co.uk/public_html/wp-content/plugins/wc-cart-pdf/vendor/mpdf/mpdf/src/Image/ImageProcessor.php on line 589
There has been a critical error on this website.
Please if you can help me fix this a bit quickly that would be awesome as teh website is live and lotsof customers are complaining
Looks like mPDF is unable to locate your image. Try adding the following to your theme functions.php file:
add_filter( 'wc_cart_pdf_mpdf', function( $mpdf ) { $mpdf->curlAllowUnsafeSslRequests = true; return $mpdf; } );
I did it but still no result same issue
The following should work to fix the issue of images not rendering, please add the following to your functions.php file:
add_filter( 'wc_cart_pdf_mpdf', function( $mpdf ) { $mpdf->curlUserAgent = 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/91.0.4472.114 Safari/537.36'; return $mpdf; } );
- The topic ‘Upgraded to version 2.3.1 images show up as broken links’ is closed to new replies.