Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 1024563
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 16, 20262026-05-16T11:47:47+00:00 2026-05-16T11:47:47+00:00

I am using the FPDF library for generating PDF files by PHP. This library

  • 0

I am using the FPDF library for generating PDF files by PHP. This library is working fine with plain text(i.e PDF files are generating for any text), but this is giving me an error of FPDF error: Missing or incorrect image file:{MY_FILE_PATH} while trying to add an image to my PDF page. Accessed that file path through the browser, then the corresponding image is appearing fine.

My code is:

require('fpdf.php');

$pdf = new FPDF();
$pdf->AddPage();
$pdf->SetFont('Arial', 'B', 16);
$pdf->Write(10, 'Example image');
$image_path = MY_FILE_PATH; // This variable contains my actual file path 
$pdf->Image($image_path, 10, 10, 350, 450);
$pdf->Output();

This code is working perfectly in my localhost and generating the corresponding PDF files even with the images also, but this is not working after moving to the server.

I have tried with these possibilities like:

  1. With absolute and relative paths for the image.

  2. Tried with a local image placed in the same folder.

  3. All image formats like jpg, png and gif also.

  4. Checked the permissions for the image and corresponding folders also.

None of these cases are working for me, stuck with this problem, can anyone help me to slove this issue.

Thanks!

Siva …

  • 1 1 Answer
  • 3 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-16T11:47:48+00:00Added an answer on May 16, 2026 at 11:47 am

    After a long struggle finally I found the reason for this issue which I’ve already discussed here.

    Mainly this problem is due to the ‘allow_url_fopen’ setting which is not enabled for my server, I’ve solved this issue by using the CURL. I’m giving the step by step procedure to solve this issue because this may useful for somebody like me to avoid wastage of time(for finding the solution).

    1. Create a temporary file in the local system with write permission.
    
    Ex: $fp = @fopen($local_file_path, 'x'); 
        fclose($fp);
    
    2. Get the remote location file contents using CURL and write that to local file 
    which is created in the previous step.
    
    Ex: $curl = new CurlWrapper($remote_file_path);
        $curl->copyToFile($local_file_path);
    
    3. Now send this local file path to FPDF function(image) then the corresponding 
    PDF will get generate for the file without any issues.
    
    

    I think this is one method to solve this issue, if anybody knows some other ways then you can post them here so that this question may be useful for somebody.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm working with generating .pdf's from PHP using this library: http://www.fpdf.org/ I am currently
I'm using fpdf library to generate some pdf files with php. At this moment
I'm using fpdf to create some pdf's from a HTML-form. Everything is working fine
My first php question... I'm using fpdf to generate pdf files. The original version
I am using fpdf library and generating pdfs... What happens when i click ExportToPdf
I have generated a pdf using fpdf library. The datas are exported to pdf
I have some problem with inserting image when i generate pdf using FPDF library
I am writing some PHP code to create PDFs using the FPDF library. And
I am using PHP and FPDF to generate a PDF with a list of
So I coded a PDF document using fpdf (PHP) However when we go to

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.