dontQQ Posted April 15, 2007 Share Posted April 15, 2007 I found this script a while ago to put images from a folder into a database. I modified it and made some test output. I have the output page displaying all the thumbnails images in one table, then creating links to the main images in another table. I want the main images to be displayed in an iframe, but when I click on the thumbnails, a bunch of encoded base64 stuff appears. :'( Here's my what my output page is doing: $sql = "SELECT * FROM thumbs;"; $result = mysql_query($sql); while ($row = mysql_fetch_array($result) ) { $tid = $row["tid"]; $encodeddata = $row["sixfourdata"]; print " <a href=image.php?pid=$tid target=frame><img src=image.php?tid=$tid></a><BR><BR> "; } Here's what the image.php file is doing: if ($_GET["pid"]) { $pid = $_GET["pid"]; $sql = "SELECT * FROM pictures WHERE pid=$pid;"; $result = mysql_query($sql); while ($row = mysql_fetch_array($result) ) { $pid = $row["pid"]; $encodeddata = $row["sixfourdata"]; } mysql_close($conn); echo base64_decode($encodeddata); } if ($_GET["tid"]) { $tid = $_GET["tid"]; $sql = "SELECT * FROM thumbs WHERE tid=$tid;"; $result = mysql_query($sql); while ($row = mysql_fetch_array($result) ) { $tid = $row["tid"]; $encodeddata = $row["sixfourdata"]; } mysql_close($conn); echo base64_decode($encodeddata); } pid stands for picture id. tid stands for thumb id. If anyone could help me with getting the picture to be correctly displayed in the frame, that'd be great. If I'm being a newb, you can laugh, but still please help. >< Link to comment https://forums.phpfreaks.com/topic/47064-displaying-base64-images-need-help/ Share on other sites More sharing options...
genericnumber1 Posted April 15, 2007 Share Posted April 15, 2007 uhm, I'm not sure EXACTLY what you mean but if you want to display an image you also have to send an image header... something like header('Content-Type:image/png'); or whatever your image type is. Link to comment https://forums.phpfreaks.com/topic/47064-displaying-base64-images-need-help/#findComment-229565 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.