Search code examples
phpimagefpdf

FPDF header() image Can not open image issue


For FPDF header() image retun below error

Uncaught Exception: FPDF error: Can not open image file:xxxxx.com

I have checked image path folder & file permission also.

Please any one help how to fix the issue.


Solution

  • Change the image URL to DOCUMENT_ROOT URL

    $ImagePath ='http:xxxxxxxxxxx.com/image/image1.png';
    

    TO

    $ImagePath = $_SERVER["DOCUMENT_ROOT"].'/image/image1.png';
    
    
    $pdf->Image($ImagePath);