Page 1 of 1
Display images from database within HTML
Posted: Sun Feb 18, 2007 9:47 pm
by chaser7016
Can anyone suggest a good how to do this?
I have figure out how to upload photos using mysql and php, placing them into a specific folder. Now I want to display those images onto my html page.
Thanks,
Chaser
Posted: Sun Feb 18, 2007 10:51 pm
by dude81
I have figure out how to upload photos using mysql and php, placing them into a specific folder. Now I want to display those images onto my html page.
Is it that you want both uploading script and then display the images. For this I better suggest you forum search, where in you can find lot of file-uploading scripts. I'm sure that you will find atleast one method matching your requirement.
Posted: Mon Feb 19, 2007 12:26 am
by chaser7016
Thanks...sorry for confusion.
I just need the html code and php script that will dispaly in the images in my html page. I got the uploading working and the uploading script uploads to my images folder.
Posted: Mon Feb 19, 2007 12:36 am
by feyd
We've talked about this subject matter quite a bit. What have you found in your research?
Posted: Mon Feb 19, 2007 12:46 am
by chaser7016
Nothing yet...Im still looking
thanks to anyone who can point me to a solid up to date how to on this matter. Posting a code suggestion here would rock too!
Cheers, Chaser
Posted: Mon Feb 19, 2007 4:25 am
by onion2k
You've worked out how to upload an image to a server, but you can't figure out how to display an image in HTML?
Posted: Mon Feb 19, 2007 7:38 am
by feyd
chaser7016 wrote:Nothing yet...Im still looking
What were your search terms?
Posted: Wed Feb 21, 2007 6:44 am
by dhrosti
i
think you use <img src="?id=xx" /> to place the image into the document and then set image/jpeg headers (or similar) using $_GET['id'].
Something like...
Code: Select all
<?php
if (isset($_GET['id'])) {
$imgId = $_GET['id'];
$sql = "SELECT * FROM table WHERE id=$imgId";
$query = mysql_query($sql);
$arr = mysql_fetch_array($query);
header("content-type: ".$arr['mimeType']);
echo $arr['fileData'];
}
?>
EDIT: sorry i didnt notice you said the images are in a folder. ignore me.