Re: Image from db

From: Date: Sat, 24 Mar 2001 00:30:05 +0000
Subject: Re: Image from db
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-45379@lists.php.net to get a copy of this message
You need to have a separate page that returns that image as if it were a static file on your site. ------- image.php?id=42 ------------- <?php $query = 'select blob from blobs where id = $id'; #I'm sure that's not the right SQL... $image = pg_something($result, 'image'); $imagetype = pg_something($result, 'image_type'); #$image now contains the JPG or GIF or PNG #and $imagetype is image/jpg or image/gif or image/png header("Content-type: $imagetype"); header("Content-length: " . strlen($image)); #more headers here for, say, caching etc echo $image; ?> Then, in your HTML, you would have: <IMG SRC=image.php?id=42> -- Visit the Zend Store at http://www.zend.com/store/ Wanna help me out? Like Music? Buy a CD: http://l-i-e.com/artists.htm Volunteer a little time: http://chatmusic.com/volunteer.htm ----- Original Message ----- From: Kassai Istvan <kako_j@freemail.hu> Newsgroups: php.general Sent: Friday, March 16, 2001 4:12 AM Subject: [PHP] Image from db > Hello everyone! > > Could anyone help me? My problem is the following: > I have to insert an image from a PostgreSQL database(Large Object), into > a web- page. > > > How can I make it? > > Thanks, bye! > Istvan Kassai > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, e-mail: php-general-unsubscribe@lists.php.net > For additional commands, e-mail: php-general-help@lists.php.net > To contact the list administrators, e-mail: php-list-admin@lists.php.net >

« previous php.general (#45379) next »