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" <[EMAIL PROTECTED]> 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
>[EMAIL PROTECTED]

_____________________________________________________________
Get [EMAIL PROTECTED] email Today!
Visit http://mail.getitgear.com

Reply via email to