Dale Mentzer wrote:
>How do the various other browsers
>(not just Windows, either) handle that problem?
They don't depend on the identification the server sends them as. Therefor
the images can just as easily be sent as plain/html for all they care.
>How much code would it take to identify graphic file types and
>then report an "error" code that the calling program (core.exe?)
>would use to rename them correctly, and of course, call the
>appropriate conversion program? Just some thoughts.
The control would be something like this (it must be inside core.exe so
that we can use whatever program we want for converting/viewing images).
void is_it_a_jpeg_or_a_gif(FILE *file)
{
char buf[4];
fread(buf, 4, 1, file);
if(strcmp(buf, "JFIF") == 0)
it_is_a_jpeg();
else if(strcmp(buf, "GIF8") == 0)
it_is_a_gif();
else
we_dont_know_let_mime_cfg_handle_it();
}
So the code wouldn't be that much (this is a very easy test that can be
fooled of course, but it shouldn't mix up GIFs and JPEGs - besides it
should only be used on <IMG> tags.
Still the fault is on the server end (by whoever put the files there from
the begining).
BTW: This code hasn't been tested...