Hi Robert,
Thanks for the code. I tried the code, and it works fine (no errors) except instead of getting an image output, it
outputs"/tmp/php08543baa" to the browser or something similar (just like my code). Am I missing something where I
shouldbe transferring a temp file to something web-readable - or is my Postgres doing something funny? Sorry if this
soundsdense but I've followed a number of examples and I thought the actual image was supposed to be sent directly to
thebrowser using pg_loreadall.
Thanks again!
--- "Robert B. Easter" <reaster@comptechnews.com> wrote:
><?php
>/*
> Takes arg: imageid=oid of image
>*/
>
>$conn = pg_pconnect("user=username dbname=databasename");
>
>pg_exec($conn, "begin");
>@ $fd = pg_loopen($conn, $imageid, "r");
>if($fd) {
> $hdr = pg_loread($fd, 4);
> switch($hdr) {
> case "\xFF\xD8\xFF\xE0":
> Header( "Content-type: image/jpeg" );
> break;
> case "GIF8":
> Header( "Content-type: image/gif" );
> break;
> case "\x89PNG":
> Header( "Content-type: image/png" );
> break;
> }
> echo $hdr;
> pg_loreadall($fd);
> pg_exec($conn, "end");
>}
>else {
> echo "Query rejected.";
>}
>
>pg_close($conn);
>?>
>-------------------------------------------------------------------------------
>--
>Robert B. Easter
>reaster@comptechnews.com
_____________________________________________________________
Get YourName@getitgear.com email Today!
Visit http://mail.getitgear.com