RE: [PHP-WIN] Re: getting an image from a database
| From: | Dash McElroy | Date: | Tue, 30 Jul 2002 20:42:51 +0000 |
| Subject: | RE: [PHP-WIN] Re: getting an image from a database | ||
| Groups: | php.windows | ||
| Request: | Send a blank email to php-windows+get-15033@lists.php.net to get a copy of this message | ||
Oops. It looks like it has to be "inline". See this comment on PHP.net:
dpiper@stens.com
23-May-2002 05:34
For inline images (JPEG for example):
header('Content-Type: image/jpeg');
header('Content-Disposition: inline; filename=file.jpg);
For attachments (Adobe PDF for example):
header('Content-Type: application/pdf');
header('Content-Disposition: attachment; filename=file.pdf);
NOTE: In Internet Explorer, the Content-Disposition header is important,
otherwise it will be inline. 'Content-Disposition: attachment' will ALWAYS
make IE download it.
NOTE: In Netscape, if you want to force it to be a download (i.e. not
inline), use header('Content-Type: application/octet-stream').
Netscape doesn't appear to care about the Content-Disposition header apart
from when it's in an email message, then the header controls behaviour as
expected.
It's best to be specific about the file you're sending. Don't rely on the
interpretation of the browsers in the face of missing or default headers.
Content-Length is good to set for downloads, since it will allow the
browser to show a progress meter. It has to be accurate otherwise the
browser will stall in downloading.
-----Original Message-----
From: Dash McElroy [mailto:Dash@westonefcu.org]
Sent: Tuesday, July 30, 2002 1:41 PM
To: PHP Windows
Subject: RE: [PHP-WIN] Re: getting an image from a database
I think that IE chokes when you don't give it more header information. You
may have to give it a Content-Disposition: "filename.png" as well in the
header command.
http://www.php.net/manual/en/function.header.php
Good luck.
-Dash
p.s. stupid IE
-----Original Message-----
From: Scott Carr [mailto:scarr@progbits.com]
Sent: Tuesday, July 30, 2002 1:39 PM
To: PHP Windows
Subject: Re: [PHP-WIN] Re: getting an image from a database
Sorry, I read it, just didn't register before I wrote the email. ;-)
In that case, just use Mozilla or Opera. ;-) jk...
Joking aside:
What version of IE? Can you send an image file directly from your file
system
to IE and have the image rendered properly? I.E. Have an image file on the
c
drive, and use readfile to pass the file to the system.
--
Scott Carr
OpenOffice.org
Documentation Maintainer
http://documentation.openoffice.org/
Quoting David Elliott <list@elliott.uk.com>:
> Hi Scott
>
> On 30 July 2002 at 15:10:50 -0500 (which was 21:10 where I live) Scott
Carr
> emanated these words of wisdom
>
> > What field type are you using to store the image?
>
> DataType of image (on MSSQL 2000). As I said it works for Opera &
Nutscrape,
> the image can also be pulled out properly by Crystal Reports.
>
> --
> Bye, _______________________________________________
> David | David Elliott | Software Engineer
|
> _________________________| list@elliott.uk.com | PGP Key ID 0x650F4534
|
> | Sector Not Found (A)bort, (R)etry, (C)offee?
|
>
>
> --
> PHP Windows Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>
-------------------------------------------------
This mail sent through IMP: http://horde.org/imp/
--
PHP Windows Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
--
PHP Windows Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php