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
Display images from database within HTML
Moderator: General Moderators
-
chaser7016
- Forum Commoner
- Posts: 34
- Joined: Sat Nov 04, 2006 3:22 pm
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.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.
-
chaser7016
- Forum Commoner
- Posts: 34
- Joined: Sat Nov 04, 2006 3:22 pm
-
chaser7016
- Forum Commoner
- Posts: 34
- Joined: Sat Nov 04, 2006 3:22 pm
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...
EDIT: sorry i didnt notice you said the images are in a folder. ignore me.
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'];
}
?>