热门标签 | HotTags
当前位置:  开发笔记 > 编程语言 > 正文

dompdf图像不是真实图像,不能读或空。-dompdfimagenotrealimagenotreadableorempty

imhavingproblemswithdompdf,theimagesiinsertwontreadwhenconvertedtopdffile我对dompdf有问

i'm having problems with dompdf, the images i insert wont read when converted to pdf file

我对dompdf有问题,当转换为pdf文件时,我插入的图像不会读取。

when i load it to dompdf using

当我把它加载到dompdf中。

php method

php方法

" />

i get a box thumbnail with an X on it

我得到一个带有X的方框缩略图。

and it says "image not real image not readable or empty" with the url of my image printed in text

并且它说“图像不是真实的图像不能读或空”和我的图像的url打印在文本。

but when i use the whole url

但是当我使用整个url时。


it shows up just fine.

它表现得很好。

what could be the solution for this?

有什么办法解决这个问题呢?

4 个解决方案

#1


2  

I had the exact same problem, no images were displaying for me - background images and inline ones. I had to set DOMPDF_ENABLE_REMOTE to true in your config dompdf_config.inc.php

我有同样的问题,没有图像显示给我-背景图像和内联的图像。我必须在配置dompdf_config.inc.php中设置DOMPDF_ENABLE_REMOTE到true。

Just note the security risk if you have this enabled along with DOMPDF_ENABLE_PHP

只要注意安全风险,如果您和DOMPDF_ENABLE_PHP一起启用了这个功能。

#2


0  

Are you loading this code directly into dompdf:

您是否将此代码直接加载到dompdf中:

$html = '" />';
$dompdf->load_html($html);

or

$dompdf->load_html_file(foo.php);

Or are you loading the processed PHP document:

或者您正在加载已处理的PHP文档:

$html = '';
$dompdf->load_html($html);

or

$dompdf->load_html_file('http://example.com/foo.php');

If the PHP content is not being processed prior to loading it into dompdf then it will not be processed at all. By default (as of 0.6.0) does not process any PHP code in the HTML document. You would have to set DOMPDF_ENABLE_PHP to true.

如果PHP内容在加载到dompdf之前没有被处理,那么它将不会被处理。默认情况下(0.6.0)不会处理HTML文档中的任何PHP代码。您必须将DOMPDF_ENABLE_PHP设置为true。

#3


0  

I had this same problem.

我遇到了同样的问题。

Correct it by setting the file dompdf_config.inc.php:

通过设置文件dompdf_config.inc.php来纠正它:

def ('DEBUGKEEPTEMP', true);

def(“DEBUGKEEPTEMP”,真正的);

Hope this helps.

希望这个有帮助。

#4


0  

Setting DEBUGKEEPTEMP to true worked, but if you are paranoid, and wary of the effect of turning this on, you can also add self::$_cache=array(); to the end of class Image_Cache's clear();

将DEBUGKEEPTEMP设置为true工作,但是如果您是偏执的,并且对打开它的效果保持警惕,您还可以添加self::$_cache=array();到类Image_Cache的clear()的末尾;


推荐阅读
author-avatar
书友79086887
这个家伙很懒,什么也没留下!
PHP1.CN | 中国最专业的PHP中文社区 | DevBox开发工具箱 | json解析格式化 |PHP资讯 | PHP教程 | 数据库技术 | 服务器技术 | 前端开发技术 | PHP框架 | 开发工具 | 在线工具
Copyright © 1998 - 2020 PHP1.CN. All Rights Reserved | 京公网安备 11010802041100号 | 京ICP备19059560号-4 | PHP1.CN 第一PHP社区 版权所有