Re: Displaying an image, that is pulled from a DB, inline

From: Date: Wed, 21 Feb 2001 16:09:09 +0000
Subject: Re: Displaying an image, that is pulled from a DB, inline
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-40984@lists.php.net to get a copy of this message
dspimage.inc <?php include_once('database.egn'); header('Expires: Mon, 26 Jul 1997 05:00:00 GMT'); header('Last-Modified: ' . gmdate('D, d M Y H:i:s') . ' GMT'); header('Cache-Control: no-cache, must-revalidate'); header('Pragma: no-cache'); if ( $prod_r = fetch_db_value('product_image', "WHERE product_id = $product_id ") ) { if ($prod_r['product_image']) { Header("Content-Type: {$prod_r['product_image_type']}"); echo $prod_r['product_image']; exit(); } } Header('Content-Type: image/gif'); readfile("$DOCUMENT_ROOT/image/nopic.gif"); ?> index.php <?php echo " <img src='include/dspimage.inc?product_id=123456'> "; ?> -- Chris Lee Mediawaveonline.com em. lee@mediawaveonline.com ph. 250.377.1095 ph. 250.376.2690 fx. 250.554.1120 ""Boget, Chris"" <Chris.Boget@wild.net> wrote in message news:4040BBE81A9AD411BD27009027887A7C042A97@tiger.wild.net... > Is it possible to pull an image, stored as binary data in a > mySQL table, and display it on a page inline? So it acts > as if the image was pulled from the file system normally? > > If it is possible, could you point me to some online resources > that would give information on how this is done? I've tried > a few things on my end to no avail. I've also searched a > few PHP sites (PHPBuilder, etc) but couldn't find anything > there (I could be doing the wrong searches). > > In any case, any information would be most helpful!! > > thnx, > Chris >

« previous php.general (#40984) next »