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 <[EMAIL PROTECTED]>
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: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> To contact the list administrators, e-mail: [EMAIL PROTECTED]
>


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]

Reply via email to