List:General Discussion« Previous MessageNext Message »
From:Oliver Artelt Date:March 14 1999 12:43pm
Subject:Re: Displaying image from database
View as plain text  
On Sun, 14 Mar 1999, kalle volkov wrote:

> hi!
> 
> if u use PHP3 and MySQL then the PHP script should look smthng like
> this:
> ---
> image.php3
> ---
> <?
> MYSQL_CONNECT("my.host.somewhere","myuser","myspassword") OR DIE("server
> is not reachable");
> @MYSQL_SELECT_DB("MyDatabase") OR DIE("database is unavailable");
> $question = MYSQL_QUERY("SELECT image FROM table WHERE ID = '$myID'");  
> $image = MYSQL_RESULT($question,0,"image");
> Header(  "Content-type:  image/gif");  
> echo $image; 
> flush(); 
> ?>
> ---
> 
> and in html/php3 script that calls the script add 
> ---
> showimage.php3
> ---
> <IMG SRC="image.php3?ID=foo">
> ---
> 

Try  <IMG SRC="image.php3/foo.gif".*> (and $REQUEST_URI for your pic-ID)
to get a valid download path. This is O.K., because the URI is evaluated
from left to right to find the first matching mimetype extension.

oli.

------------------------------------------------------------------------------
Oliver Artelt                                     Jordanstr.7, 39112 Magdeburg
mailto:oli@stripped                    Tel: 0391-6112827 Fax: 0391-604243 
------------------------------------------------------------------------------
http://www.transnet.de                         ISP: Wir schaffen Verbindungen!
http://www.magdeburg-online.de              Die Magdeburger Online-Information
------------------------------------------------------------------------------

Thread
Displaying image from databaseRobert Hazeltine14 Mar
  • Re: Displaying image from databasekalle volkov14 Mar
    • Re: Displaying image from databaseRobert Hazeltine14 Mar
      • Re: Displaying image from databaseThimble Smith15 Mar
    • Re: Displaying image from databaseOliver Artelt15 Mar
  • Re: Displaying image from databaseSasha Pachev15 Mar
Re: Displaying image from databaseChris17 Mar
  • Re: Displaying image from databaseTommi Rintala17 Mar