Why does IE save pictures from the Web in bitmap format?

Jan 18
2006 14:46 (Development, PHP) · Русский (9,755 views)

Today I found very disagreeable problem with Internet Explorer. I’ve generated GIF-image with PHP GD2 and sent results for client browser. In IE I’ve tried to store picture in my local file system but only option is to save the picture as a .BMP file instead of as a native .gif file! The same problem is described in Microsoft Knowledge Base, but it does not help me.

Then I start playing with PHP and headers and discover very nice gizmo: bug became apparent only when my PHP-script uses session_start(). But I’ve need sessions! Solution is very simple: it was necessary to add following lines before image output:

header("Cache-Control:");
header("Pragma:");
header("Set-Cookie:");

This lines will clear all headers sent by session_start() function and IE will understand that your the image is in right format.

7 Responses to 'Why does IE save pictures from the Web in bitmap format?'

Subscribe to comments with RSS or TrackBack to 'Why does IE save pictures from the Web in bitmap format?'.

1
erka
said on 2006-01-19 at 11.17 am

угу, видел такое. но не игрался для устранения ошибки. спасибо за исследование и решение проблемы

2
said on 2006-05-11 at 9.43 am

Спасибо! Сегодня наткнулся и был очень рад, что знаю, где брать ответ. :-)

3
said on 2007-03-28 at 11.55 pm

Very useful and interesting aricle. Can I translate and insert this on my site?
Greetings
Aukcje

4
said on 2007-03-29 at 11.18 am

Of course you can. Just don’t forget to insert link to original one.

5
said on 2007-04-25 at 9.38 pm

спасибо большое за решение… :)

6
dkrnl
said on 2007-07-21 at 9.00 pm

тоже намучался с этим - наткнулся на ваш пост.
решение есть более элегантное:
session_cache_limiter(’none’)

7
said on 2007-10-14 at 6.28 pm

session_cache_limiter(’none’)
если можно обьясните новичку

Post a comment

You can use simple HTML-formatting tags (like <a>, <ul> and others). To format your code sample use <code lang="php">$a = "hello";</code> (allowed languages are ruby, php, yaml, html, csharp, javascript). Also you could use <code>$a = "hello";</code> and its syntax would not be highlighted. If you are not using <code> tag, replace < sign with &lt;.

Submit Comment

 
Copyright © 2005 - 2008, Dmytro Shteflyuk