Jump to content

Error getting and using a string from a database with FPDF


willo_the_wisp

Recommended Posts

Hi,

 

I'm creating a PDF document using the FPDF library. All is fine, using a sample image that came with the library.

However, I need to get the data for the PDF from a database.

The data's fine - the query is performed and the data prints out as I need. However, there's one line which takes a value which is a filepath. When I put that into the following line, I get an error from FPDF:

 

Code: $this->Image($row['imgpath'],10,10,190);

Error produced: FPDF error: Image file has no extension and no type was specified:

 

However, if I print out the value of $row['imgpath'] and manually insert it into the code as follows, it works fine:

Code: $this->Image('../assets/images/products/5777A.jpg',10,10,190);

 

I've come across this problem once before but can't for the life of me remember what the solution was. It was something to do with how I was reading the value into the code, I think.

Can anyone jog my memory, please??

 

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.