Received: from localhost (maia-5.hub.org [200.46.204.182]) by postgresql.org (Postfix) with ESMTP id B46F19FB637 for ; Wed, 13 Jun 2007 05:52:06 -0300 (ADT) Received: from postgresql.org ([200.46.204.71]) by localhost (mx1.hub.org [200.46.204.182]) (amavisd-maia, port 10024) with ESMTP id 62423-01 for ; Wed, 13 Jun 2007 05:51:59 -0300 (ADT) X-Greylist: from auto-whitelisted by SQLgrey-1.7.4 Received: from svr4.postgresql.org (svr4.postgresql.org [66.98.251.159]) by postgresql.org (Postfix) with ESMTP id 645199FB61B for ; Wed, 13 Jun 2007 05:52:02 -0300 (ADT) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.3 Received: from rehuapila.uta.fi (rehuapila.uta.fi [153.1.1.45]) by svr4.postgresql.org (Postfix) with ESMTP id B276D5AF861 for ; Wed, 13 Jun 2007 08:52:00 +0000 (GMT) Received: from valkoapila.uta.fi (valkoapila.uta.fi [153.1.1.42]) by rehuapila.uta.fi (8.13.8/8.13.8) with ESMTP id l5D8puHM010151 for ; Wed, 13 Jun 2007 11:51:56 +0300 (EEST) Received: from apila.uta.fi (localhost.localdomain [127.0.0.1]) by valkoapila.uta.fi (8.13.8/8.13.8) with ESMTP id l5D8pu8G002521 for ; Wed, 13 Jun 2007 11:51:56 +0300 Received: from pippuri.uta.fi (pippuri.uta.fi [153.1.6.42]) by apila.uta.fi (8.13.8/8.13.8) with ESMTP id l5D8ptYR007972 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NOT) for ; Wed, 13 Jun 2007 11:51:55 +0300 (EEST) Received: from pippuri.uta.fi (localhost.localdomain [127.0.0.1]) by pippuri.uta.fi (8.13.4/8.13.4/Debian-3sarge3) with ESMTP id l5D8ptvJ008129 for ; Wed, 13 Jun 2007 11:51:55 +0300 Received: (from wwwroot@localhost) by pippuri.uta.fi (8.13.4/8.13.4/Submit) id l5D8ptwv008128 for pgsql-php@postgresql.org; Wed, 13 Jun 2007 11:51:55 +0300 Received: from kielitranpc59.uta.fi (kielitranpc59.uta.fi [153.1.35.59]) by imp3.uta.fi (Horde MIME library) with HTTP; Wed, 13 Jun 2007 11:51:55 +0300 Message-ID: <20070613115155.uykzmxtvxueoo4w8@imp3.uta.fi> Date: Wed, 13 Jun 2007 11:51:55 +0300 From: Mihail Mihailov To: pgsql-php@postgresql.org Subject: php, postgresql and graphical images MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8; DelSp="Yes"; format="flowed" Content-Disposition: inline Content-Transfer-Encoding: quoted-printable User-Agent: Internet Messaging Program (IMP) H3 (4.1.5-cvs) X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-3.0 (apila.uta.fi [153.1.1.41]); Wed, 13 Jun 2007 11:51:56 +0300 (EEST) X-Scanned-By: MIMEDefang 2.62 on 153.1.1.42 X-Virus-Scanned: Maia Mailguard 1.0.1 X-Archive-Number: 200706/4 X-Sequence-Number: 3806 Hi all! Does anybody have any experience in displaying images stored in =20 postgresql database? I'm trying to export image into file using pg_lo_export function and =20 then view it on html page. However, the pg_lo_export seem to work only =20 occasionaly. The code is like this: (php5, postgresql 8.2) ***************** $no++; //Incerementing number of the image pg_query("Begin"); $query =3D "select pic_data, accurateness_level, mime_type from image2 where *****//condition clause"; $row =3D pg_fetch_row(pg_query($query)); // Get the image OID $image =3D $row[0]; // Get the type of the picture $type =3D $row[2]; // Export the picture into pic.type pg_lo_export($image, "pic$no.$type"); //get image file dimensions $dimensions =3D getimagesize("pic$no.$type"); $width =3D $dimensions[0]; $height =3D $dimensions[1]; // Show the picture echo ""; pg_query("Commit"); ************* I understand that the script doesn't like the idea of saving files on =20 the server. However, why does it work at all? Are there any other ways to export images from the database? Any comments are welcome. - Mike