On Wed, May 27, 2009 at 3:05 PM, Ashley Sheridan <ash@xxxxxxxxxxxxxxxxxxxx>wrote: > On Wed, 2009-05-27 at 14:03 -0400, Bastien Koert wrote: > > On Wed, May 27, 2009 at 1:51 PM, Miller, Terion < > > tmiller@xxxxxxxxxxxxxxxxxxxx> wrote: > > > > > > > > > > > > > > On 5/27/09 12:49 PM, "Bastien Koert" <phpster@xxxxxxxxx> wrote: > > > > > > On Wed, May 27, 2009 at 1:46 PM, Shawn McKenzie <nospam@xxxxxxxxxxxxx > > > >wrote: > > > > > > > Miller, Terion wrote: > > > > > I am trying to get an image to display but I get nothing if done > like > > > > this: > > > > > > > > > > <tr> > > > > > <td>Scout Photo:</td> > > > > > > > > > > <td><img src="<?php echo $row['ePhoto'];?>"></td> > > > > > > > > > > </tr> > > > > > > > > > > > > > > > If I just echo the field I do get the file name.... > > > > > > > > > > > > > Does the filename include the path? Does the image with said > filename > > > > actually exist in that path? > > > > > > > > -- > > > > Thanks! > > > > -Shawn > > > > http://www.spidean.com > > > > > > > > -- > > > > PHP General Mailing List (http://www.php.net/) > > > > To unsubscribe, visit: http://www.php.net/unsub.php > > > > > > > > > > > Is it an image from the db or a path to an image on the filesystem? > > > > > > -- > > > > > > Bastien > > > > > > Cat, the other other white meat > > > > > > > > > Hi Bastien it is an image in the db. > > > Thanks > > > Terion > > > > > > > You can't display the image that way due to differeing headers in > required > > for html and images. Change your image code to call a page that > specializes > > in handling the images and the headers needed by changing to something > like > > this: > > > > echo "<img src=\"show_image.php?id=".$rows['id']."\">\n"; > > > > where the show_image page calls the image out from the db and display it > as > > below > > > > <?php > > require("conn.php"); > > //check to see if the id is passed > > if(isset($_GET['id'])) { > > $id=$_GET['id']; > > > > //query the database to get the image and the filetype > > $query = "select bin_data, filetype from binary_data where id=$id"; > > > > $result = mysql_query($query); > > $row = mysql_fetch_array($result); > > { > > $data = $row['bin_data']; > > $type = $row['filetype']; > > } > > if ($type=="pjpeg") $type = "jpeg"; //handle the ms jpeg > alternate > > format > > Header( "Content-type: $type"); > > echo $data; > > } > > ?> > That's only true if the image is stored in the database as a BLOB or > somesuch. If the database is just storing the filename of the image, > then it may just need the correct directory path prefix. Go into your > browser, right-click and check to see what path and filename the browser > expects to find the image file. My guess is it's not the same as where > the image actually is, and you need to add the path before opening the > <?php tag. You can use either an absolute path (e.g. using a full > http://domain) or a relative one, and relative paths can include the ../ > directory if you need to move up the directory tree. > > > Ash > www.ashleysheridan.co.uk > > Terion stated it was in the db -- Bastien Cat, the other other white meat