--- Uros Gruber <[EMAIL PROTECTED]> wrote:
> 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

Your instincts serve you well. You want the Content-Type header to be correct,
as you are currently telling the Web client that you are sending HTML, and then
(I assume) dumping a bunch of binary data.

> Image showed correctly

On what browser? IE has earned a poor reputation for its disregard for content
type, so IE's bug may be conveniently counteracting your own by coincidence.

> here is code I have in img.php
> 
> $size = getimagesize ($file);
> header("Content-type: {$size['mime']}");

OK, I see that the documentation is somewhat confusing here (I may try to fix
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
http://httphandbook.org/

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to