Julhu
Forum Replies Created
Viewing 3 replies - 1 through 3 (of 3 total)
-
Forum: Plugins
In reply to: [PDF Invoices & Packing Slips for WooCommerce] CloudFront S3 Image not found@yordansoares
I also tried that solution, but that didn’t work for me unfortunatly.Forum: Plugins
In reply to: [PDF Invoices & Packing Slips for WooCommerce] CloudFront S3 Image not foundI had the same problem as OP. There seems to be an issue when handling images from an external source.
What I did to fix it was adding a filter to convert alle images tobase64. With the downside that it will enlarge your PDF’s, but it’s better than not having working thumbnails I guess.
Here is the code I use:// PDF Invoices & Packing Slips for WooCommerce convert images to base64 as a workaround for not loading images from external sources add_filter('wpo_wcpdf_get_html', function ($html, $document) { // Convert images to base64 $html = preg_replace_callback('/<img[^>]+>/i', function ($matches) { $img = $matches[0]; $doc = new DOMDocument(); $doc->loadHTML($img); $imageTags = $doc->getElementsByTagName('img'); foreach ($imageTags as $tag) { $src = $tag->getAttribute('src'); $data = file_get_contents($src); $type = pathinfo($src, PATHINFO_EXTENSION); $base64 = 'data:image/' . $type . ';base64,' . base64_encode($data); $img = str_replace($src, $base64, $img); } return $img; }, $html); return $html; }, 10, 2);Forum: Plugins
In reply to: [Social Share Buttons by Supsystic] Linkedin URL problemHi,
Okay cool, thanks for the quick service!
Viewing 3 replies - 1 through 3 (of 3 total)