Skip site navigation (1) Skip section navigation (2)

Re: How do I display an image?

From: knut(dot)suebert(at)web(dot)de
To: pgsql-php(at)postgresql(dot)org
Subject: Re: How do I display an image?
Date: 2002-10-27 22:28:18
Message-ID: 20021027222818.GA3523@fraxinus.reticulum (view raw or flat)
Thread:
Lists: pgsql-php
Patrick Hatcher schrieb:

>          $row =  pg_fetch_array($result);
>          $type = "JPG";
>          Header( "Content-type:$type");
>          echo $row[0];

For most browsers that's enough, at least some versions of
InternetExplorer need more information:

   $data = $db->bytea_decode($db->f("data"));
   header(sprintf("Content-type: %s", $db->f("type")));
   header(sprintf("Content-Disposition: attachment; filename=%s",
                  $db->f("name")));
   header(sprintf("Content-length: %s", strlen($data)));
   print($data);

In response to

pgsql-php by date

Next:From: Carlos García GómezDate: 2002-10-28 07:43:46
Subject: Re: Problems with OIDs
Previous:From: Andrew McMillanDate: 2002-10-27 08:28:55
Subject: Re: Problems with OIDs

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group