From: Knut Suebert <knut.suebert@web.de>
To: pgsql-php@postgresql.org
Subject: faster way to display jpg-blobs?
Date: Sun, 18 Mar 2001 06:22:35 +0100
Message-ID: <20010318062235.A20520@cascal.vtb> (raw)
Hello,
I'm new to this list.
And I have the following question: is there a better/faster way than the
following to read jpeg-blobs out of the database and display them?
if( $db->next_record() ){
header("Content-Type: image/jpeg");
$bild = $db->lo_read($db->f("oid"));
header("Content-Length: 1024000"); // has to be calculated
print($bild);
}
where lo_read() is
function lo_read($oid, $mode="r"){
$this->connect();
pg_exec($this->Link_ID, "begin"); // a must for blob-operations
if( $lo_id = pg_loopen( $this->Link_ID, $oid, $mode ) ){
$lo = pg_loread( $lo_id, 1024000 ); // has to be calculated
pg_loclose($lo_id);
}
pg_exec($this->Link_ID, "end");
return $lo; // empty leer, wenn auslesen gescheitert
}
Because of the begin/end every picture on a page is loaded one after the
other, I fear. Not simultaneous as if there would be a direct <img
src='pic_N.jpg'> instead of <img src='pic.php?id=N'>.
Using blobs is a must IMHO, as viewing the pics should only be possible for
authorized people.
Thanks, bye,
Knut
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients from your mail client; the link fills in
the headers below: reply via email
Some clients, webmail especially, drop In-Reply-To and References from
a link, and the reply then starts a new thread: use the mbox below.
To: pgsql-php@postgresql.org
Cc: knut.suebert@web.de
Subject: Re: faster way to display jpg-blobs?
In-Reply-To: <20010318062235.A20520@cascal.vtb>
References: <20010318062235.A20520@cascal.vtb>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox