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

dovercomputersAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

dovercomputersAuthor Commented:
Fixed it myself.

Must declare glabal variable for use in header function.
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
PHP

From novice to tech pro — start learning today.