简体   繁体   中英

FPDF error displaying image

I'm using FPDF to generate PDF. I have some pictures on my server and I'm trying to display them in a 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 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,);

But the solution is to enable zlib, if you manage a hosting or do it locally in xampp it is enabled by default:

-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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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