faster way to display jpg-blobs? - Mailing list pgsql-php

From Knut Suebert
Subject faster way to display jpg-blobs?
Date
Msg-id 20010318062235.A20520@cascal.vtb
Whole thread Raw
Responses Re: faster way to display jpg-blobs?  (Knut Suebert <knut.suebert@web.de>)
List 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






pgsql-php by date:

Previous
From: "Jon Tai"
Date:
Subject: Re: the "correct" way to login.
Next
From: Knut Suebert
Date:
Subject: Re: faster way to display jpg-blobs?