From: | Knut Suebert <knut(dot)suebert(at)web(dot)de> |
---|---|
To: | pgsql-php(at)postgresql(dot)org |
Subject: | faster way to display jpg-blobs? |
Date: | 2001-03-18 05:22:35 |
Message-ID: | 20010318062235.A20520@cascal.vtb |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-php |
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
From | Date | Subject | |
---|---|---|---|
Next Message | Knut Suebert | 2001-03-18 07:11:44 | Re: faster way to display jpg-blobs? |
Previous Message | Jon Tai | 2001-03-17 09:58:15 | Re: the "correct" way to login. |