【问题标题】:TCPDF cache problems when using https使用 https 时的 TCPDF 缓存问题
【发布时间】:2017-03-27 07:56:29
【问题描述】:

一段时间以来,我们一直在使用 TCPDF 即时创建 PDF,一切正常。

但是,我们今天使用以下 htaccess 代码更改为 https:

RewriteCond %{SERVER_PORT} 80 
RewriteRule ^(.*)$ https://www.berau.at/$1 [R,L]

现在我们得到以下 TCPDF 错误:

TCPDF ERROR: [Image] Unable to get image: /home/.sites/64/site1783/web/pdf2/cache/img_UgqqR0

如果我们删除 https 的 htaccess 重定向,一切都会再次正常运行。

我们已经搜索了 TCPDF 网站,但那里没有提到 https 问题。

TCPDF 缓存文件夹已拥有 755 权限!

这是我们用来调用图像的代码:

$img_file = $rs_produkt[20];
$pdf->Image($img_file, 0, 0, 0, 0, '', '', '', false, 300, '', false, false, 0);

提前感谢您的帮助!

【问题讨论】:

  • 加载该图像的代码是什么样的?
  • @Jakuje 刚刚插入调用图像的 TCPDF 代码

标签: .htaccess https tcpdf


【解决方案1】:

这是我们问题的解决方案:

tcpdf.php 中的第 23847 行包含对 http 的直接引用。将这一行从

if (preg_match('%^/{2}%', $tag['attribute']['src'])) {
                        $tag['attribute']['src'] = 'http:'.$tag['attribute']['src'];
                    }

if (preg_match('%^/{2}%', $tag['attribute']['src'])) {
                        $tag['attribute']['src'] = 'https:'.$tag['attribute']['src'];
                    }

一切正常。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2019-08-19
    • 2012-01-15
    • 1970-01-01
    • 1970-01-01
    • 2016-05-31
    • 1970-01-01
    • 1970-01-01
    • 2012-03-28
    相关资源
    最近更新 更多