[Webinar] Streamline your web hosting managementRegister Today

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 983
  • Last Modified:

FPDF image from MySQL major problem

Hello experts!

I am trying to create a pdf from data stored in mysql database. When trying to create the header I cannot get the image from mysql to display.

The image does exist and I can see it if I type the url directly. If I echo $row_search_results['main_photo']
it shows me the correct filename IMG_0791.JPG

But I get the following error if I just try and create the pdf.

Warning: getimagesize() [function.getimagesize]: Filename cannot be empty in /home/survey/public_html/property/fpdf/fpdf.php  on line 1202
FPDF error: Missing or incorrect image file:

If I hard code the image it works fine.
$this->Image('property_images/IMG_0791.JPG',0,0);

Please help!
Many thanks
$logo = "property_images/".$row_search_results['main_photo']; 

require('fpdf/fpdf.php');

class PDF extends FPDF
{
//Page header
function Header()
{
    //Logo
    $this->Image($logo,0,0);

Open in new window

0
dovercomputers
Asked:
dovercomputers
1 Solution
 
dovercomputersAuthor Commented:
Fixed it myself.

Must declare glabal variable for use in header function.
0

Featured Post

Hire Technology Freelancers with Gigs

Work with freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely, and get projects done right.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now