Image Header
| From: | Uros Gruber | Date: | Mon, 11 Aug 2003 19:46:48 +0000 |
| Subject: | Image Header | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-159184@lists.php.net to get a copy of this message | ||
Hi!
I don't know if this is ok, so can somebody give me some explanation.
I made some php script to get Header from http request. When I request
some image header looks like:
HTTP/1.1 200 OK
Date: Mon, 11 Aug 2003 17:24:14 GMT
Server: Apache/1.3.27 (Unix) PHP/4.3.1
Last-Modified: Fri, 25 Oct 2002 09:37:57 GMT
ETag: "1cd2ce-1253f-3db910f5"
Accept-Ranges: bytes
Content-Length: 75071
Connection: close
Content-Type: image/jpeg
===========================================
Then I made some php script to showing images and when i request for
example img.php?name=somejpg.jpg header looks like this:
HTTP/1.1 200 OK
Date: Mon, 11 Aug 2003 17:24:14 GMT
Server: Apache/1.3.27 (Unix) PHP/4.3.1
X-Powered-By: PHP/4.3.1
Connection: close
Content-Type: text/html
===========================================
Why?. Image showed correctly and here is code I have in img.php
=================================
$file = $_GET['name'];
if (ereg('(\.\.)^(\/+)',$file)) {
die();
}
$file = dirname(__FILE__).'/'.$file;
$size = getimagesize ($file);
$fp = fopen($file, "rb");
if ($size && $fp) {
header("Content-type: {$size['mime']}");
fpassthru($fp);
exit;
} else {
}
So I set Content-type: but on request is html/text. And one more
question. Is it possible that IE or mozzila cache those kind of
images. For example that I ser Cache header option..
--
tia,
Uros