954,561 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?
Have something to say? Contribute New Article Reply to this Article

display image file from mysql databse using php

I'm having a problem with displaying my profile images from a database .the upload works fine,but no image is displayed:Could you please help!

I have the following code which cant work:

1. main profile page has the following script:

<?php echo 'XXXXX_XXX.php?id=$Current_Person_Id';

---------------------------------------------------------------------------------

2.the image page has the following script:
$result = mysqli_query($link,"select * from person where Person_Id='1

$result = mysqli_query($link,"select * from XXX where Person_Id='$Current_Person_Id'");

////starting the inner validation

//else if($result){

$row_count=0;

while($row = mysqli_fetch_array($result))
{
//$row_color = ($row_count % 2) ? $color1 : $color2;
$content=$row['Photo_Content'];
$name=$row['Photo_Name'];
$type=$row['Photo_Type'];
$size=$row['Photo_Size'];
$row_count++;
}
header("Content-length:$size");
header("Content-type:$type");
header("Content-Disposition: inline; filename=$name");
//header('filename=$name');
//Content-Disposition: attachment;
echo $content;


Note:

The variables:$size,$type,$name are stored in database too.
I'm able to print all of them except the content.
Could it be my php configuration orsomething to do with images?

I've attached the image icon displayed..here....

wuodpam
Newbie Poster
2 posts since Jun 2008
Reputation Points: 10
Solved Threads: 0
 

Try running the image script in a separate page (the image link) and see if there's any error message pops up.
If you don't see any error, configure php.ini to display_error=On and then try again (after restart apache)

gpm1982
Newbie Poster
6 posts since Feb 2008
Reputation Points: 12
Solved Threads: 1
 

An X icon is displayed but not the actual image...

I've attached a copy of a "snag it" web view of the display page alone..

Attachments image1.jpg 1.13KB
wuodpam
Newbie Poster
2 posts since Jun 2008
Reputation Points: 10
Solved Threads: 0
 

This article has been dead for over three months

Post: Markdown Syntax: Formatting Help
You