0

Hi,
Currently I am working on a site that lets users upload photos for their personal page.
This page is just a prototype so some of the code is very sloppy so I really should not post all of it. Anyway, here is some:

$id =$_GET['id'];
if(!isset($id) || empty($id)){
die("Please select your image!");
}else{

$query = mysql_query("SELECT * FROM upload WHERE id='".$id."'");
$row = mysql_fetch_array($query);
$content = $row['content'];

header ('Content-type: image/jpg');
echo $content;
}

My problem is the photo is displayed but not with all the html from the page.
I'm thinking that it's the header at the end.
My question is how can I display photo in a html page. All tutorials I found just teach how to display image on blank page.
Thanks

2
Contributors
3
Replies
4
Views
7 Years
Discussion Span
Last Post by P0lT10n
0

Hello phpDave, you could do an echo in an <img> tag... for example:

<img src="<? echo $content; ?>" alt="" width="" height="" />
0

Thanks!
It's not working but I think it could be close.

0

Thanks!
It's not working but I think it could be close.

But in $content, you must put your dir image, for example, if i have a dir called images and my .php is in images, i direct echo the name.extension of image, but if my .php is in the main folder, you must echo images/name.extension... do you understand ???

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.