CodeMama Posted May 28, 2009 Share Posted May 28, 2009 I am having big difficulties getting my stored images to show up, the images are there, I can echo the properties, but when I try and display them, nada, anyone see where I'm going wrong? Here is the embedded tag for the image on my display page (as you can see I have tried it several different ways in case my mistake is here) : <a href="image.php?filename=<?php echo$row['photoName']; ?>"><?php echo$row['photoName']; ?></A><br> <?php echo "\n<br>Scout Photo : "."<img src=\image.php?filename=" .$row['photoName']. "\">"; ?> <?php echo "<img src=\"image.php?filename=".$row['photoName']."\">\n"; ?> <?php echo "<img src=\"image.php?id=".$row['ePID']."\">\n"; ?> <img src="image2.php?filename=<?php echo $row['photoName']; ?>"> ??? Here is the code from my image.php page (the one that is supposed to set the right headers to display the image) include("inc/dbconn_open.php"); error_reporting(E_ALL); //if (isset($_FILES['ePhoto'])){$ePhoto = $_FILES['ePhoto'];} else {$ePhoto ="";} $filename = $_GET['$filename']; $image = stripslashes($_REQUEST[photoName]); $sql = "SELECT ePhoto, photoName, photoType from eagleProjects WHERE photoName = $filename"; $result=mysql_query($sql); $data = mysql_fetch_array ($result); $type = $data['photoType']; $name = $data['photoName']; header("Content-type: $type"); header("Content-Disposition: attachment; filename=$name"); echo $data["photoName"]; echo $data["ePhoto"]; exit; thanks in advance if anyone can figure this out, I am getting burnt out!! ??? :'( Quote Link to comment Share on other sites More sharing options...
ToonMariner Posted May 28, 2009 Share Posted May 28, 2009 the script to show your image should echo nothing more than that field from the database and set the headers... this should give you the pointers http://www.phpriot.com/articles/images-in-mysql/8 - note that the script uses id's to grab the data rather than the filename itself. Quote Link to comment Share on other sites More sharing options...
CodeMama Posted May 28, 2009 Author Share Posted May 28, 2009 Thanks I did change it to use the ID ...still nothing, I am starting to wonder if it's a server / headers issue or something ..I'm lost and been working on this all day, thankfully I get to leave the office in one more hour...here is what my image.php page looks like now: $ePID = $_GET['$ePID']; $image = stripslashes($_REQUEST[photoName]); $sql = "SELECT ePhoto, photoName, photoType from eagleProjects WHERE ePID = ".$_GET['ePID']." "; $result=mysql_query($sql); $data = mysql_fetch_array ($result); $type = $data['photoType']; $name = $data['photoName']; header("Content-type: $type"); header("Content-Disposition: attachment; filename=$name"); echo $data['ePhoto']; exit; Quote Link to comment Share on other sites More sharing options...
ToonMariner Posted May 28, 2009 Share Posted May 28, 2009 whats the field type in teh database? try removing the content-disposition header - just to see what happens... prop drop the exit too!!! Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.