Re: OID output problems

From: surfer girl <gidget(at)getitgear(dot)com>
To: "Robert B(dot) Easter" <reaster(at)comptechnews(dot)com>, gidget(at)getitgear(dot)com, pgsql-general(at)postgresql(dot)org
Subject: Re: OID output problems
Date: 2000-05-03 03:43:19
Message-ID: 20000503024320.1E64040B9@sitemail.everyone.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

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 should be transferring a temp file to something web-readable - or is my Postgres doing something funny? Sorry if this sounds dense but I've followed a number of examples and I thought the actual image was supposed to be sent directly to the browser using pg_loreadall.

Thanks again!

--- "Robert B. Easter" <reaster(at)comptechnews(dot)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(at)comptechnews(dot)com

_____________________________________________________________
Get YourName(at)getitgear(dot)com email Today!
Visit http://mail.getitgear.com

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Anand Raman 2000-05-03 03:53:36 Re: postgresql7.0 jdbc driver
Previous Message Robert B. Easter 2000-05-03 02:51:55 Re: OID output problems