473,387 Members | 1,502 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

How to do this in MSIE: saving a GIF image which was generated on-the-fly

Dear All,

I am developing / maintaining a web application which generates GIF
images on the fly. When I send the image, I make sure a header is sent
first with MIME-type image/gif. My HTML-code to show the image looks
like this:

<IMG SRC="http://myserver/scripts/mycgi.exe?page=graphsym&favid=myfav4&numlines=1&ke y=18"
BORDER="0">

In Netscape 7.1 I can rightclick the image and save it as GIF, because
the image irecognised as GIF! However, in MSIE I can only save it as
BMP!!! MSIE does not even understand that it is a GIF, although the
image is shown all right. After rightclicking and choosing properties,
MSIE tells me that the TYPE is not available. Anyway, even with images
having a clear GIF-extension, this type is not available.

Is there really no trick to be applied on the serverside or the
clientside to make sure the image can be saved in MSIE as GIF? I know
this non-feature of MSIE has been a subject of discussion for a number
of years. No solution at all, still? TIA

Kind regards,
Dobedani
Jul 23 '05 #1
7 2067
In comp.infosystems.www.authoring.html Dobedani said:
In Netscape 7.1 I can rightclick the image and save it as GIF, because
the image irecognised as GIF! However, in MSIE I can only save it as
BMP!!!


known bug
http://support.microsoft.com/default...b;en-us;810978
--
v o i c e s
Jul 23 '05 #2
Dobedani wrote:
I am developing / maintaining a web application which generates GIF
images on the fly. When I send the image, I make sure a header is sent
first with MIME-type image/gif. My HTML-code to show the image looks
like this:

<IMG
SRC="http://myserver/scripts/mycgi.exe?page=graphsym&favid=myfav4&numlines=1&k
ey=18"
BORDER="0">

In Netscape 7.1 I can rightclick the image and save it as GIF, because
the image irecognised as GIF! However, in MSIE I can only save it as
BMP!!! MSIE does not even understand that it is a GIF, although the
image is shown all right.


This is a common problem. What you have to do is provide your visitors with
a filename that ends in ".gif" instead of ".exe". On Apache servers you can
do this by adding a RewriteRule to your .htaccess file.

You can't solve this problem with HTML, so try posting your question in a
newsgroup that's relevant to the software running on your server.

Phil
--
Philip Ronan
ph***********@virgin.net
(Please remove the "z"s if replying by email)
Jul 23 '05 #3

"Philip Ronan" <ph***********@virgin.net> wrote in message
news:BD954F13.23C28%ph***********@virgin.net...
Dobedani wrote:
I am developing / maintaining a web application which generates GIF
images on the fly. When I send the image, I make sure a header is sent
first with MIME-type image/gif. My HTML-code to show the image looks
like this:

<IMG
SRC="http://myserver/scripts/mycgi.exe?page=graphsym&favid=myfav4&numlines=1&k
ey=18"
BORDER="0">

In Netscape 7.1 I can rightclick the image and save it as GIF, because
the image irecognised as GIF! However, in MSIE I can only save it as
BMP!!! MSIE does not even understand that it is a GIF, although the
image is shown all right.
This is a common problem. What you have to do is provide your visitors
with
a filename that ends in ".gif" instead of ".exe". On Apache servers you
can
do this by adding a RewriteRule to your .htaccess file.

You can't solve this problem with HTML, so try posting your question in a
newsgroup that's relevant to the software running on your server.


I have come across this problem several times. (assuming you're not
suffering from the internet cache problem mentioned in the previous reply)

IE often ignores the mime type; it simply looks back from the end of the URL
until it finds a dot and determines the file extension from that.

So, assuming you know the file type when you generate the <img> tag, just
make sure the url ends in .gif thus:

http://myserver/scripts/mycgi.exe?pa...=1&key=18&.gif

Phil
--
Philip Ronan
ph***********@virgin.net
(Please remove the "z"s if replying by email)

Jul 23 '05 #4
Andy Fish wrote:
IE often ignores the mime type; it simply looks back from the end of the URL
until it finds a dot and determines the file extension from that.

So, assuming you know the file type when you generate the <img> tag, just
make sure the url ends in .gif thus:

http://myserver/scripts/mycgi.exe?pa...lines=1&key=18
&.gif


.... I didn't realize IE was THAT stupid!

What I was suggesting was something like this:
<http://www.japanesetranslator.co.uk/nj?n=andy>

The image is generated by a PHP script with a long search string tagged on
to the end of the filename, but to keep the low-IQ browsers happy I'm using
a RewriteRule to make it look like a file called "Andy.png"

--
Philip Ronan
ph***********@virgin.net
(Please remove the "z"s if replying by email)
Jul 23 '05 #5
Andy Fish wrote:
"Philip Ronan" wrote ...
Dobedani wrote:
I am developing / maintaining a web application which generates
GIF images on the fly. When I send the image, I make sure a
header is sent first with MIME-type image/gif.

in MSIE I can only save it as BMP!!! MSIE does not even
understand that it is a GIF


IE often ignores the mime type; it simply looks back from the end of
the URL until it finds a dot and determines the file extension from
that.


That would be different than its previous behavior. IE used to sniff the
*contents* of a file to guess its content type, in violation of relevant
protocols. Only if content-sniffing failed would IE resort to other
measures, such as the MIME header, which is supposed to be definitive,
or "file extension", which is rather meaningless in the context of a
url, but that's Microsoft for you.

Recently, MS claimed to have fixed this. However, in announcing the
changes on their website, they advised web authors to make sure that the
file extension matched the content type. As I said, file extension is
meaningless in a url.[1] I have not downloaded the security patch that
fixes that security hole (and doubtless introduces new ones), so I
cannot test whether MS now looks at "file extension", whatever that
means. But I'd be suspicious, at least, that characters after a "."
would make a difference unless you can test the claim.
[1] File extension is only relevant on the server, which might use it to
choose an appropriate content-type header. But the changes MS announced
were for MSIE, not for IIS.

--
Brian (remove "invalid" to email me)
Jul 23 '05 #6
Brian (us*****@julietremblay.com.invalid) wrote:

: Recently, MS claimed to have fixed this. However, in announcing the
: changes on their website, they advised web authors to make sure that the
: file extension matched the content type. As I said, file extension is
: meaningless in a url.[1]

it's relevent for `file:' urls, and `ftp:' urls

: [1] File extension is only relevant on the server, which might use it to
: choose an appropriate content-type header.

Yes, pretty much every server, including apache, guesses what the mime
type should be based on the file name extension.

Ironic isn't it?

The problem with IE is that the security sucks. It has little to nothing
to do with file name extensions or mime content types, and everything to
do with the design of the product and its environment.
Jul 23 '05 #7
Malcolm Dew-Jones wrote:
Brian wrote:
[1] File extension is only relevant on the server, which might use
it to choose an appropriate content-type header.


Yes, pretty much every server, including apache, guesses what the
mime type should be based on the file name extension.


That depends on the filesystem, too. And Apache, at least, can be
configured in other ways. It is quite common to treat all files in a
particular directory a certain way, e.g., cgi, regardless of any file
extension.
Ironic isn't it?
Not really, no. MSIE claims to be an HTTP user agent, not a file system.
Unix, by contrast is a file system.
The problem with IE is that the security sucks. It has little to
nothing to do with file name extensions or mime content types,


Wrong. MIME guessing is a security concern. I'll grant you that there
are other security concerns, but cannot agree that MIME guessing is trivial.

--
Brian (remove "invalid" to email me)
Jul 23 '05 #8

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: dave | last post by:
Hi there I need to build code to download automatically image to my local disk. somethink like i will specify url in code and it fetches image from that location and save in my local disk. for...
4
by: funcSter | last post by:
Hey, got a prob which is driving me nuts! I'm trying to resize the resolution of an image as well as it's pyhsical byte size. I've got: byte bytImage = null; System.Drawing.Image imgImage =...
1
by: JSheble | last post by:
I need to save a bitmap object as a G4 Compressed TIF file... any help would be tremendously appreciated...
7
by: Marc Pelletier | last post by:
Hello all, I have a class which includes a method to create a chart. I want to be able to call this method from asp.net code as well as windows application code, so I have sketched it out as...
2
by: Gustavo De la Espriella | last post by:
Hi, I'm having trouble resizing images while mantaining resolution. I used the following code to save a jpeg file to disk, but with the GetThumbImage it loses resolution....
3
by: David | last post by:
hi... i have webform *.aspx file, wich do some bd requests and generates (how it should) html file to show on client pc.. now... i want my web solution, this web form is part of this solution,...
0
by: jamesjames | last post by:
Hello, could anyone tell me how to save a bitmap from picturebox.image as a 24bpprgb bitmap? picturebox.Image.Save(path, ImageFormat.Bmp) saves a 32bpprgb bitmap and Bitmap bmp =...
1
by: dedisource | last post by:
Hello guys Pl. can give me a solutions for a image saving tool in that i need to save bigger image size 24" x 18" with 150dpi, as my designing tool is working well but client need to save his design...
10
by: Nathan Sokalski | last post by:
I am using ASP.NET 2.0, and need to know how to save and use an image that is stored in an SQL Server image datatype. How can I do this using ASP.NET? Thanks.
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.