简体   繁体   English

FPDF 错误显示图像

[英]FPDF error displaying image

I'm using FPDF to generate PDF.我正在使用 FPDF 生成 PDF。 I have some pictures on my server and I'm trying to display them in a PDF.我的服务器上有一些图片,我正在尝试以 PDF 格式显示它们。 I don't get any error message and my php page just shows an HTTP ERROR 500. The link to the image is correct, I can access it in my browser but when I put it in the Image() , it just doesn't work.我没有收到任何错误消息,我的 php 页面只显示一个 HTTP 错误 500。图像的链接是正确的,我可以在浏览器中访问它,但是当我将它放入Image() ,它只是没有工作。

 <?php require ('../include/fpdf181/fpdf.php'); class PDF extends FPDF { } $pdf->Image($link, 130, 240, 70, 50); $pdf->Output();

Thanks.谢谢。

First of all you have poorly declared parameters.首先,您的参数声明不当。

$ pdf-> Image ('path_of_the_image', 130, 240, 70, 50, $ link,); $ pdf-> Image ('path_of_the_image', 130, 240, 70, 50, $link,);

But the solution is to enable zlib, if you manage a hosting or do it locally in xampp it is enabled by default:但是解决方案是启用 zlib,如果您管理托管或在 xampp 中本地执行,则默认情况下启用:

-First Optimize Website leave it in Compress All Content. -首先优化网站将其保留在压缩所有内容中。
-You have to go to select php version there you have to enable zlib.output_compression. - 你必须去选择 php 版本,你必须启用 zlib.output_compression。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM