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

 

Archived

This topic is now archived and is closed to further replies.

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