Dompdf远程图像未以pdf显示
在我的服务器上,通过dompdf生成的pdf没有显示图像. 因为它们是远程URL图像.(本地图像工作正常) 然后我知道它需要一些设置才能渲染远程图像.
On my server pdf generated via dompdf was not displaying images. Because they are remote url images.(local images are working fine) then I come to know that it needs some settings to render remote images.
allow_url_fopen = true => i can not as server control is not in my hand.(and no one will suggest to do this due to security reasons)
read/write access to the DOMPDF_TEMP_DIR (already have this)
DOMPDF_ENABLE_REMOTE = true (already have this)
因此,为确保allow_url_fopen的问题,我在本地主机中将false设置为与服务器相同的输出.
So to sure the issue of allow_url_fopen, I set false in my localhost which is now giving the same output as server.
所以,现在的问题是我现在想以allow_url_fopen = false
- 我尝试了将近5-10种独特的方法来做到这一点.
- 我试图在php文件中显示图像(通过设置标题),然后 在pdf中显示php链接
- 我也尝试通过php的绝对路径显示图像,但是什么也没有 工作.
- 我尝试通过函数中的curl获取图像,然后显示 放在一个php文件中...但是没有运气.
- I tried almost 5-10 unique ways to do this.
- I tried to display image in php file (via setting headers) and then displaying the php link in pdf
- I tried to display image via absolute path to php too but nothing worked.
- I tried via getting image via curl in a function and then displaying it in a php file ...but no luck.
有没有人可以建议我如何显示pdf图片. 我总是得到的错误是...
Is there anyone can suggest me how can I display image in pdf please. The error I am always getting is ...
Image not found
http://localhost/dompdf/image.php
和
Image not found
http://localhost/dompdf/image.jpg
我遇到了同样的问题, 在实时服务器上找不到dompdf图像
I had the same problem, dompdf image not found on live server
我找到了解决方案,您只需要仔细检查图像路径,
I found its solution, you just need to double check the image path,
考虑实时服务器映像路径
Considering your live server image path
<img src="http://www.example.com/public/images/thumb.png">
您只需将其更改为
<img src="public/images/thumb.png">
注意:请确保所有设置都与您已经进行的设置相同.
Note: Make sure that, all settings are same as you have already made.
我希望这会对您有所帮助.
I hope this will help you.