{"id":219,"date":"2017-09-04T14:58:00","date_gmt":"2017-09-04T14:58:00","guid":{"rendered":"https:\/\/demos.welaunch.io\/woocommerce-pdf-catalog\/?post_type=faq&#038;p=219"},"modified":"2020-07-29T14:33:25","modified_gmt":"2020-07-29T12:33:25","slug":"images-pdf-displays-red-cross-https-mpdf","status":"publish","type":"faq","link":"https:\/\/www.welaunch.io\/en\/knowledge-base\/faq\/images-pdf-displays-red-cross-https-mpdf\/","title":{"rendered":"Images in PDF displays as a red cross (https \/ mpdf)"},"content":{"rendered":"<p>First\u00a0 please make sure, that you are not on a <strong>localhost<\/strong> AND do not have any <strong>.htaccess \/ .passwd<\/strong> on your sever. Because our plugin uses HTTP to get the images for the PDF creation and if your server blocks the images from public it won&#8217;t work.<\/p>\n<p>Problem not solves? Read further:<\/p>\n<p class=\"answer\">Please make sure you have installed \/ configured the following in your Server PHP Extensions:<\/p>\n<ol>\n<li>CURL Enabled (php_curl.dll enabled)<\/li>\n<li>PHP.ini (allow_url_fopen = On)<\/li>\n<li>GD Library installed<\/li>\n<\/ol>\n<p>To debug image loading go to plugin settings &gt; advanced settings. There enable the MPDF Debug mode:<\/p>\n<figure id=\"attachment_5507\" aria-describedby=\"caption-attachment-5507\" style=\"width: 861px\" class=\"wp-caption aligncenter\"><img loading=\"lazy\" decoding=\"async\" class=\"size-full wp-image-5507\" src=\"https:\/\/www.welaunch.io\/en\/wp-content\/uploads\/sites\/8\/2017\/09\/MPDF-Debug-Mode.png\" alt=\"MPDF debug mode\" width=\"861\" height=\"203\" srcset=\"https:\/\/www.welaunch.io\/en\/wp-content\/uploads\/sites\/8\/2017\/09\/MPDF-Debug-Mode.png 861w, https:\/\/www.welaunch.io\/en\/wp-content\/uploads\/sites\/8\/2017\/09\/MPDF-Debug-Mode-247x58.png 247w, https:\/\/www.welaunch.io\/en\/wp-content\/uploads\/sites\/8\/2017\/09\/MPDF-Debug-Mode-510x120.png 510w, https:\/\/www.welaunch.io\/en\/wp-content\/uploads\/sites\/8\/2017\/09\/MPDF-Debug-Mode-300x71.png 300w, https:\/\/www.welaunch.io\/en\/wp-content\/uploads\/sites\/8\/2017\/09\/MPDF-Debug-Mode-768x181.png 768w\" sizes=\"auto, (max-width: 861px) 100vw, 861px\" \/><figcaption id=\"caption-attachment-5507\" class=\"wp-caption-text\">MPDF debug mode<\/figcaption><\/figure>\n<p>Look what the image errors show. Maybe you find the issue yourself.<\/p>\n<p>If images still do not display you can solve the issue by the following ways:<\/p>\n<p><strong>Quick and Dirty:<\/strong><\/p>\n<p>Add the following to the mpdf.php file on line 12954 -&gt; function:\u00a0file_get_contents_by_curl()<\/p>\n<pre>curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);<\/pre>\n<p>Source:\u00a0https:\/\/stackoverflow.com\/questions\/5657382\/curl-php-restful-service-always-returning-false<\/p>\n<p><strong>Better:<\/strong><\/p>\n<p>The better solution is to manually add only the certificate(s) or CA(s) you want to accept<\/p>\n<pre>;;;;;;;;;;;;;;;;;;;;\r\n; php.ini Options  ;\r\n;;;;;;;;;;;;;;;;;;;;\r\n\r\ncurl.cainfo = \"C:\\xampp\\php\\extras\\ssl\\cacert.pem\"\r\n<\/pre>\n<p>Source:\u00a0https:\/\/stackoverflow.com\/questions\/24611640\/curl-60-ssl-certificate-unable-to-get-local-issuer-certificate<\/p>\n<p><strong>On Nginx?<\/strong><\/p>\n<p>Some nginx server disallow some agents in the CURL header. Therefore you will need to change the header. Go to plugin-folder\/includes\/mpdf\/mpdf.php &gt; Line: 12965.<\/p>\n<p>Then change the\u00a0CURLOPT_USERAGENT value to\u00a0&#8216;User-Agent: curl\/7.39.0&#8217;<\/p>\n<p>Example:<\/p>\n<pre>curl_setopt($ch, CURLOPT_USERAGENT, 'User-Agent: curl\/7.39.0');<\/pre>\n","protected":false},"author":1,"featured_media":0,"menu_order":0,"comment_status":"open","ping_status":"closed","template":"","product_cat":[],"class_list":["post-219","faq","type-faq","status-publish","hentry","faq_topics-pdf-catalog-faq"],"_links":{"self":[{"href":"https:\/\/www.welaunch.io\/en\/wp-json\/wp\/v2\/faq\/219","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.welaunch.io\/en\/wp-json\/wp\/v2\/faq"}],"about":[{"href":"https:\/\/www.welaunch.io\/en\/wp-json\/wp\/v2\/types\/faq"}],"author":[{"embeddable":true,"href":"https:\/\/www.welaunch.io\/en\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.welaunch.io\/en\/wp-json\/wp\/v2\/comments?post=219"}],"version-history":[{"count":1,"href":"https:\/\/www.welaunch.io\/en\/wp-json\/wp\/v2\/faq\/219\/revisions"}],"predecessor-version":[{"id":5508,"href":"https:\/\/www.welaunch.io\/en\/wp-json\/wp\/v2\/faq\/219\/revisions\/5508"}],"wp:attachment":[{"href":"https:\/\/www.welaunch.io\/en\/wp-json\/wp\/v2\/media?parent=219"}],"wp:term":[{"taxonomy":"product_cat","embeddable":true,"href":"https:\/\/www.welaunch.io\/en\/wp-json\/wp\/v2\/product_cat?post=219"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}