Thread: Re: How to send bytea data straight to browser (as in pg_loreadall)?

Re: How to send bytea data straight to browser (as in pg_loreadall)?

From
Frank Joerdens
Date:
On Mon, Apr 01, 2002 at 08:31:01PM +0200, Frank Joerdens wrote:
[ . . . ]
> understand some crucial point about how this works. How do you present
> an image to the browser without actually creating a file for it? The
> built in function pg_loreadall appears to do exactly that. I'd need to
> replicate that functionality for bytea.

An addition: Actually, just echoing the stripcslashed string to the
browser works just as with pg_loreadall if I put the script that does
the echoing into a teensy little html page as in

<img src="show_image.php">

where show_image.php is just a script that does

echo stripcslashes(pg_result($result, 2, image));

(after doing the sql stuff, that is).

Which means that I know how to do it without a tmp file. However, I
still don't understand the mechanism and I still don't know how to do it
in a single script. It appears that you have to provide a file path for
the <img src . . . tag. Can you do that *within* a script without
creating a tmp file somehow?

Regards, Frank