当我们将以下行添加到htaccess文件时:
RewriteCond %{SERVER_PORT} 80
RewriteRule ^(.*)$ https://www.example.com/$1 [R=301,L]我们收到以下错误:
Warning: getimagesize(/icon/logo_print.jpg): failed to open stream: No such file or directory in /home2/example/public_html/tcpdf/include/tcpdf_images.php on line 171
Warning: imagecreatefromjpeg(/icon/logo_print.jpg): failed to open stream: No such file or directory in /home2/example/public_html/tcpdf/tcpdf.php on line 7039
TCPDF ERROR: [Image] Unable to get the size of the image: /image/1/SB_m.gif相关代码:
class MYPDF extends FPDI { // extends TCPDF
public function Header() { // Page header
global $dbcmpName;
$html = <<<EOF
<table cellpadding="2" >
<tr>
<td><img src="/icon/logo_print.jpg" alt="$dbcmpName Logo" style="border:none;" /></td>
<td><span class="header1" >$dbcmpName</span>
</td>
</tr>
</table>
EOF;
// output the HTML content:
$this->SetFont('verdana', '', 9);
$this->writeHTML($html, true, false, true, false, '');
}
...
if ( file_exists($_SERVER['DOCUMENT_ROOT'] . '/image/' . $prodFamilly . '/'. $db->f('prd_photo')) ) {
$html .= '
<img src="/image/' . $prodFamilly . '/' . $db->f('prd_photo') . '" alt="' . $imgAlt . '" />
';
}
// output the HTML content:
$pdf->writeHTML($html, true, false, true, false, '');
...注意:有一个类似的问题- TCPDF cache problems when using https,但在这个问题中,他们使用了不同的方式来显示图像,没有超文本标记语言,当尝试修改建议的答案时,我在tcpdf文件中找不到建议更改的代码,可能是因为我们使用了不同版本的tcpdf:
// File name : tcpdf.php
// Version : 6.2.13
// Begin : 2002-08-03
// Last Update : 2015-06-18发布于 2019-01-14 18:23:59
使用tcpdf版本6.2.26而不是6.2.13似乎可以解决我的问题。
他们在版本6.2.25中更改了img URL,也许这就是我需要的修复
https://stackoverflow.com/questions/54061129
复制相似问题