467,913 Members | 1,798 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 467,913 developers. It's quick & easy.

I want to display image blob from db to fpdf

Here is my code but it error
================================================== ===
Expand|Select|Wrap|Line Numbers
  1. $this->Cell(
  2.     15,
  3.     15,
  4.     this->Image(
  5.         $row['image'],
  6.         $this->GetX(),
  7.         $this->GetY(),
  8.         15,
  9.         15
  10.     ),
  11.     1, 0
  12. );
Jul 21 '20 #1
  • viewed: 1436
Share:
2 Replies
gits
Expert Mod 4TB
what error do you get exactly?
Jul 21 '20 #2
16bit
The problem is that you can't pull from the SQL directly in FPDF, rather you need to store the blob in a global var and then use that, because FPDF can't interact with the SQL statement, because it is a class. A class can't interact with variables constructed outside the class UNLESS it is a global var. Thus you need something like:

Expand|Select|Wrap|Line Numbers
  1. global $image;
  2. $image = $row['image]';
  3. ...
  4.  this->Image(
  5.         $image,
  6. $this->GetX(),
  7.         $this->GetY(),
  8.         15,
  9.         15
  10.     ),
  11. ...
  12.  
1 Days ago #3

Post your reply

Sign in to post your reply or Sign up for a free account.

Similar topics

7 posts views Thread by Philipp Lenssen | last post: by
2 posts views Thread by Olav Tollefsen | last post: by
1 post views Thread by Tan | last post: by
2 posts views Thread by RedSouljaz | last post: by
2 posts views Thread by David | last post: by
3 posts views Thread by den 2005 | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.