Re: Re: Displaying images

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Shawn McKenzie wrote:
> Miller, Terion wrote:
>> Thanks for the suggestions everyone, I have this now, but still no image showing up
>>
>> It is stored as a blob in the database.
>>
>> on the output page I am calling it like this:
>>
>>     <img src="image.php?filename=<?php echo $row['ePhoto']; ?>">
> 
> I was assuming that ePhoto was the actual binary data?  If so then you
> need something else here like id or something.  I just used filename as
> an example.  If ePhoto is actually the filename then you are OK here,
> but not below.
> 
>> Then on the image.php page I have this:
>>
>> <?php
>> include("inc/dbconn_open.php");
>> error_reporting(E_ALL);
>>
>> //image.php
>> header("Content-type: img/jpeg");
>> $filename = $_GET['filename'];
>>
>> $sql = "SELECT ePhoto from eagleProjects WHERE $filename= ePhoto";
> 
> Ummm...  This can't work.  What is ePhoto???  The data or the filename?
> 
>> $result=mysql_query($sql);
>> $row = mysql_fetch_assoc ($result);
>>
>>
>>
>> ?>
>>
>> <?php echo $row['ePhoto']; ?>
>>
>> This page isn't working and if I try to browse this page it wants to open it with an editor, it won't view in the browser.
>>
>> What am I doing wrong? Is it the code or the data?
>>
>> Thanks
>> Terion
> 
> 

I don't know what your fields are, but if ePhoto is the BLOB, and you
have an id field, then try this (assuming that you have selected id in
your query and it is an integer):

<img src="image.php?id=<?php echo $row['id']; ?>">

//image.php
$id = (int)$_GET['id'];
$sql = "SELECT ePhoto from eagleProjects WHERE id=$id";

-- 
Thanks!
-Shawn
http://www.spidean.com

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux