本文介绍了在MPDF中带有https的图像的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用MPDF生成带有图像的pdf.使用http://一切正常,但是将我的整个网站更改为https://之后,我只会在应该显示图像的地方出现红叉.

I am using MPDF to generate a pdf with images. With http:// all works fine, but after changing my whole site to https:// I only get red crosses where the images should appear.

如果我将生成的文件视为html版本,则所有图像都在其中,并且带有https://,但是在生成的PDF中它们只是不显示.

If I watch the generated file as html version, the images are all there, with https://, but in the generated PDF they are just not shown.

有任何提示吗?

更新:错误是由于CURL("SSL证书问题:无法获取本地颁发者证书")

UPDATE:Error was because of CURL("SSL certificate problem: unable to get local issuer certificate")

已通过添加curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);来解决到mpdf.php

It was resolved by adding curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);to mpdf.php

在这里找到答案: curl:(60)SSL证书:无法获取本地颁发者证书

肮脏的方式: cURL PHP RESTful服务始终返回FALSE

推荐答案

对于来自Google的任何人-现在有一个更好的解决方案. mPDF现在支持设置curlAllowUnsafeSslRequests.

For anyone coming here from Google - there is now a better solution. mPDF now supports setting curlAllowUnsafeSslRequests.

$mdf = new Mpdf(<your configuration>);
$mpdf->curlAllowUnsafeSslRequests = true;

这将为您正确设置CURL参数,而无需修改mPDF. 显然,仅在适当的情况下使用,因为这会禁用SSL的所有验证保护.

This will set the CURL parameters properly for you without having to modify mPDF. Obviously, use only in appropriate situations, as this disables SSL all verification protections.

这篇关于在MPDF中带有https的图像的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

10-15 03:14