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

Member Avatar for P0lT10n

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

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

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

Member Avatar for P0lT10n

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 ???

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.