Ask a Question related to PHP Development, Design and Development.
-
Uros Gruber #1
Image Header
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
Uros Gruber Guest
-
How to use image as pannel header?
hi all, we here here are building a flex application for Laingorourke UK's domestic housing solution, which will cater the dynamic needs of... -
Sorting when there's an image in the header doesn't seem to work....
I've got a datagrid that works just ducky. I then put in the headers image and now my sort event doesn't get fired. If I take out just the... -
Image in header column (not replacing column header text)
I have a sortable (asc/desc) datagrid and would like to add a small arrow icon (down/up) next to the column header text to improve the UI. Is this... -
DataGrid with image in the Column Header
Is it possible to have both an image and text as part of a Column Header in a DataGrid? Ideally, you could click on either sort the column. I have... -
Datagrid and header with image
Iam trying to implement sorting. I know how to display a button in the header of an datagrid. How can i display an image with down arrow and... -
Chris Shiflett #2
Re: [PHP] Image Header
--- Uros Gruber <uros.gruber@sir-mag.com> wrote:
Your instincts serve you well. You want the Content-Type header to be correct,> I made some php script to get Header from http request. When I
> request some image header looks like:
>
> HTTP/1.1 200 OK
> 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
> Content-Type: text/html
as you are currently telling the Web client that you are sending HTML, and then
(I assume) dumping a bunch of binary data.
On what browser? IE has earned a poor reputation for its disregard for content> Image showed correctly
type, so IE's bug may be conveniently counteracting your own by coincidence.
OK, I see that the documentation is somewhat confusing here (I may try to fix> here is code I have in img.php
>
> $size = getimagesize ($file);
> header("Content-type: {$size['mime']}");
this). The key phrase in the manual preceding this example is:
"Beginning with PHP 4.3, getimagesize() also returns an additional parameter,
mime, that corresponds with the MIME type of the image."
So, before we continue, can you tell us what version of PHP you are using? You
might want to just do this:
header('Content-Type: image/jpeg');
Hope that helps.
Chris
=====
Become a better Web developer with the HTTP Developer's Handbook
[url]http://httphandbook.org/[/url]
Chris Shiflett Guest
-
Uros Gruber #3
Re[2]: [PHP] Image Header
Hello,
Monday, August 11, 2003, 10:42:58 PM, you wrote:
CS> --- Uros Gruber <uros.gruber@sir-mag.com> wrote:CS> Your instincts serve you well. You want the Content-Type header to be correct,>> I made some php script to get Header from http request. When I
>> request some image header looks like:
>> Content-Type: text/html
CS> as you are currently telling the Web client that you are sending HTML, and then
CS> (I assume) dumping a bunch of binary data.
CS> On what browser? IE has earned a poor reputation for its disregard for content>> Image showed correctly
CS> type, so IE's bug may be conveniently counteracting your own by coincidence.
On both mozzila and IE.
CS> OK, I see that the documentation is somewhat confusing here (I may try to fix>> here is code I have in img.php
>>
>> $size = getimagesize ($file);
>> header("Content-type: {$size['mime']}");
CS> this). The key phrase in the manual preceding this example is:
CS> "Beginning with PHP 4.3, getimagesize() also returns an additional parameter,
CS> mime, that corresponds with the MIME type of the image."
CS> So, before we continue, can you tell us what version of PHP you are using? You
CS> might want to just do this:
Server: Apache/1.3.27 (Unix) PHP/4.3.1
I check that i get correct MIME, so header is OK. Also if i manualy
set to jpeg, nothing helps.
CS> header('Content-Type: image/jpeg');
I think I'm stuck here.
best regards
Uros
Uros Gruber Guest



Reply With Quote

