[Search for users] [Overall Top Noters] [List of all Conferences] [Download this site]

Conference terri::web_authoring

Title:Welcome to WEB_AUTHORING
Notice:Before writing, please check for an existing topic
Moderator:VAXCAT::LAURIE
Created:Tue Mar 05 1996
Last Modified:Thu Jun 05 1997
Last Successful Update:Fri Jun 06 1997
Number of topics:186
Total number of notes:1479

172.0. "Using BMP files on webpages???" by PCBUOA::BAYJ (Jim, Portables) Tue Apr 08 1997 23:25

    Can someone explain to me the various incantations for MIME types?
    
    I wanted to place a BMP on my webpage, and have it displayed, in much
    the same way GIFs and JPGs are.  As I researched this, it seemed as if
    it might not be possible, until I found a page that did it!  My head is
    spinning!
    
    I'll leave off the long story, and get down to my research:
    
    Using an out-of-the-box Netscape FastTrack server, I created a page
    with two variations on it:
    
    		<img src="bermuda8.bmp"> 
    		<a href="bermuda8.bmp">bermuda</a>
    
    The image comes up "broken".  If I click on the word "bermuda", it
    displays gobbledy-goop in the text viewer window.  Same if I right click
    on the broken image and choose "View image (bermuda8.bmp).  Under
    View->document info, it tells me that image bermuda8.bmp is type
    text/plain.
    
    I assumed that the incorrect MIME type was causing the problem.  First
    I checked out my browser (Netscape Gold 3.0).  Turns out that it
    actually has a defined MIME type for .BMP files of image/x-MS-bmp. 
    
    Hmmm, sounds right.  I configured my browser to handle x-MS-bmp with
    LVIEW.  However, since the wrong MIME type was being sent, it never
    caught it.  So I edited the mime.types file to include x-MS-bmp for
    .BMP extensions.
    
    The image still comes up broken, BUT if I click on either the word
    Bermuda, or right click on the image and choose view, it will now
    launch the LVIEW app to display the image (if I *don't* configure the
    browser to use LVIEW, then I get the dialog for unknown MIME types,
    which is sort've ok).
    
    At this point I'm thinking I'll just have to have both a JPG *and* a
    BMP, let the user "see" the JPG, and if they click on it, then I'll
    download the BMP (the whole point is to allow the user to download BMP
    wallpaper for Windows).
    
    But then I tried some research.  I did an Altavista search on
    image:*.bmp, and it came up with a bunch of hits.  Moreover 
    when I visited one of these pages, even with a default browser, BMP
    files are displayed as images IN PLACE!  But when I went to VIEW INFO,
    it tells me the image is TEXT/PLAIN!!!!  So, I click on the image to
    view it, and instead of an image, it runs the text viewer, and shows me
    this:
    
    #define aso3_width 16
    #define aso3_height 16
    static unsigned char aso3_bits[] = {
       0x00, 0x00, 0xe0, 0x07, 0xb0, 0x0a, 0xf8, 0x1f, 0xfc, 0x1f, 0x56, 0x35,
       0xea, 0x2f, 0x36, 0x54, 0x2c, 0x6c, 0xb4, 0xd5, 0xec, 0xae, 0x74, 0xd5,
       0xac, 0xbf, 0xf4, 0x61, 0x34, 0xc0, 0x1c, 0x80};
    
    The image tag is a typical <img src="xyz.bmp">.  It doesn't have a
    special MIME type.  Yet, Netscape knows how to deal with this thing. 
    How????  And what is it?  It obviously won't suit my needs, because I
    want to put Windows wallpaper on the page for downloading, and this
    obviously isn't windows wallpaper.
    
    But what causes it to be recognized as an image?  Also, is creating an
    HREF tag the best I can do (possibly with a JPG image in it)?  No one
    wants broken pictures on their page.
    
    jeb
    
    (P.S.  The URL, FYI, is:
    
    	http://www.mit.edu:8001/activities/arab/homepage.html
    )
    
T.RTitleUserPersonal
Name
DateLines
172.1HOUBA::MEHERSDamian, http://bigbird.geo.dec.com/Wed Apr 09 1997 10:394
    
    A guess - try flushing all cash in Browser.
    
    	/Damian
172.2Do you need to bother?HNDYMN::MCCARTHYA Quinn Martin ProductionWed Apr 09 1997 11:598
>>    download the BMP (the whole point is to allow the user to download BMP
>>    wallpaper for Windows).

Um, Netscape 3.0 has a "set as wallpaper" function that I've used to set
the background of .jpg files.  You mb2 (or right-most mb button) while over
the gif/jpg image and the popup has a "set as wallpaper" option.

bjm
172.3it is just a text fileHNDYMN::MCCARTHYA Quinn Martin ProductionWed Apr 09 1997 12:4640
Another note:

>>    The image tag is a typical <img src="xyz.bmp">.  It doesn't have a
>>    special MIME type.  Yet, Netscape knows how to deal with this thing. 

Um, I don't think you'll find MIME incoding inside of GIF or JPG files either,
they are just not as nice to look at as BMP (gee that looks like X bitmap 
files).  

Utilities like xv, Imagemagick just look for a "magic number" of sorts inside
the file.  For bmp or xmp files, that "magic number" is several lines.  
The <img src= has told Netscape to try to treat this as an image so it started
looking for the "magic".

I just did a quick test and Netscape (OpenVMS version) displays the 
"quote_icon.bmp" correctly when it is included as:
<img src="quote_icon.bmp">Quote Icon

That file is below.

Brian J.

#define decw_quote_sm_width 32
#define decw_quote_sm_height 32
static char decw_quote_sm_bits[] = {
   0xaa, 0xaa, 0xaa, 0xaa, 0x55, 0x55, 0x55, 0x55, 0xfa, 0xab, 0xaa, 0xaa,
   0x01, 0x57, 0x55, 0x55, 0x52, 0xaa, 0xaa, 0xaa, 0x51, 0x56, 0x55, 0x55,
   0x52, 0xaa, 0xaa, 0xaa, 0x51, 0x56, 0x55, 0x55, 0x52, 0xaa, 0xaa, 0xaa,
   0x11, 0x56, 0x55, 0x55, 0xf2, 0xaa, 0xaa, 0xaa, 0x01, 0x55, 0x55, 0x55,
   0xaa, 0xfa, 0xaf, 0xaa, 0x55, 0x01, 0x54, 0x55, 0xaa, 0xa2, 0xac, 0xaa,
   0x55, 0x65, 0x54, 0x55, 0xaa, 0xe2, 0xaa, 0xaa, 0x55, 0x05, 0x55, 0x55,
   0xaa, 0xa2, 0xab, 0xaa, 0x55, 0x65, 0x56, 0x55, 0xaa, 0xe2, 0xec, 0xaf,
   0x55, 0x01, 0x14, 0x54, 0xaa, 0xaa, 0x8a, 0xa8, 0x55, 0x55, 0x45, 0x51,
   0xaa, 0xaa, 0xca, 0xaa, 0x55, 0x55, 0x45, 0x5d, 0xaa, 0xaa, 0xca, 0xaa,
   0x55, 0x55, 0xc5, 0x53, 0xaa, 0xaa, 0x8a, 0xa8, 0x55, 0x55, 0x15, 0x54,
   0xaa, 0xaa, 0xaa, 0xaa, 0x55, 0x55, 0x55, 0x55};




172.48153::tecotoo.mro.dec.com::mayerDanny MayerWed Apr 09 1997 14:285
	I think that you are looking at the wrong end.  The MIME type of any
  file is sent by the server in the HTTP header.  Check to see what your
  Fasttrack server has set BMP to send as a MIME type.

		Danny
172.5PCBUOA::BAYJJim, PortablesWed Apr 09 1997 18:1430
    >I think that you are looking at the wrong end.  The MIME type of any
    >file is sent by the server in the HTTP header.  Check to see what your
    >Fasttrack server has set BMP to send as a MIME type.
    
    Thats my point.  The server doesn't *have* a .BMP type defined. 
    FastTrack uses a file called "mime.types" to define the known
    variations.  There is no occurance of "bmp" in the file.  Moreover,
    when I use View->Doc-info, it says the MIME typ being sent for the .BMP
    file is text/plain, (on both the FastTrack server, and on the remote
    server where I found the "correctly" displayed BMP files).
    
    Its clear that the browser magically figures out what to do with the
    BMP file, even though there is no obvious association in the mime.types
    file for BMP files, and the remote server is obviously not sending any
    specific MIME type that the browser might use to figure it out.
    
    So, what mechanism enables the BMP file (the one stored as text format)
    to be displayed properly?  And what is the technical name of that
    format?   I just went back to the page with the .BMP file, saved it in
    my windows directory, and tried to set my wallpaper to it.  As
    expected, that format is not accepted.  
    
    And, since Netscape easily converts JPGs and GIFs (and, as it turns
    out, the text format BMP files - worked like a champ) to BMP files for
    the purposes of creating wallpaper, how come they didn't bother to
    allow it to go the other way?  How come native Netscape can't display a
    BMP file?  Aren't BMP files pretty common?
    
    jeb
    
172.6QUARK::LIONELFree advice is worth every centWed Apr 09 1997 18:504
No, the browser doesn't "magically figure it out".  If the server is sending
text/plain, that's what the browser will try to view it as.

				Steve
172.78153::tecotoo.mro.dec.com::mayerDanny MayerWed Apr 09 1997 19:1417
>    Thats my point.  The server doesn't *have* a .BMP type defined. 
>    FastTrack uses a file called "mime.types" to define the known
>    variations.  There is no occurance of "bmp" in the file.  Moreover,
>    when I use View->Doc-info, it says the MIME typ being sent for the .BMP
>    file is text/plain, (on both the FastTrack server, and on the remote
>    server where I found the "correctly" displayed BMP files).

	If the server can't determine the MIME type to send then it will use
  the default MIME type, which in the case of YOUR server is apparently
  text/plain.  The default MIME type is settable.  It is not clear from your
  message what platform the server is running on.  However if this is a
  Windows NT system then the chances are that the MIME types are stored in the
  registry rather than in a file.  In that case check the Registry for MIME
  types.  I just checked with Greg: on NT it uses the Registry for the MIME
  types.

		Danny
172.8PCBUOA::BAYJJim, PortablesWed Apr 09 1997 20:1560
    Okay, two separate issues.  
    
    Re: registry, the FastTrack Server 2.0 on NT may very well use the
    registry at runtime, but when the server starts, it loads the MIME
    types from the file mime.types, which is located in
    netscape\server\httpd-SERVERNAME\config.  There may be some "default"
    MIME types in teh registry that don't occur in the mime.types file,
    though that seems unlikely.  But when I make changes to the file
    mime.types, and restart the server, the new types are available.
    
    Second issue:
    
    I just tried it.  I copied over the text format BMP file from the web
    page I found it on, and put it on my test page.  I pulled it up, and
    sure enough, it was displayed in place on the page, right below the
    "broken" picture which points to my Windows BMP file.  
    
    I used VIEW->DOC INFO, which said the MIME type it received is
    x-MS-bmp.  Thats a red herring, because *I* put that type in the
    mime.types file of the FastTrack server.  So, I stopped the server,
    commented out that type, and restarted.  Here's the image section of
    the mime.types file:
    
    	type=image/gif                 exts=gif 
    	type=image/ief                 exts=ief 
    	type=image/jpeg                exts=jpeg,jpg,jpe
    	type=image/tiff                exts=tiff,tif 
    	type=image/x-cmu-raster        exts=ras 
    	type=image/x-portable-anymap   exts=pnm
    	type=image/x-portable-bitmap   exts=pbm 
    	type=image/x-portable-graymap  exts=pgm 
    	type=image/x-portable-pixmap   exts=ppm 
    	type=image/x-rgb               exts=rgb 
    	type=image/x-xbitmap           exts=xbm 
    	type=image/x-xpixmap           exts=xpm 
    	type=image/x-xwindowdump       exts=xwd 
    	#type=image/x-MS-bmp           exts=bmp 
    	^ comment symbol
    
    Now, when I do the same test, without any BMP MIME type known to the
    server, the text format BMP file (can anyone tell me what that format
    is called?) again displays just fine, and my Windows BMP is still
    "broken".  VIEW->DOC INFO now says the MIME type of the text BMP is
    text/plain.  In fact, while in the VIEW->DOC INFO window, if I click on
    the link for the text BMP, when it comes up, its not the actual image,
    but rather the text.  
    
    So, completely independent of any "obvious" MIME information being sent
    from the server, the browser still somehow knows that the text BMP file
    is actually an image.
    
    So, in light of this, I guess the question is, why does Netscape
    interpret the content of a text BMP file as an image, without any MIME
    cues?  I've never heard of Netscape understanding about this odd text
    format bitmap (the other question is why DON'T they internally handle
    processing of Windows format BMP files, but thats really a political
    question).
    
    jeb
    
172.9BIGUN::nessus.cao.dec.com::MayneA wretched hive of scum and villainyThu Apr 10 1997 00:427
The bitmap files in .0 and .3 are XBM (X bitmap) format files. Presumably the 
server is sending them as text/plain, and the client is clever enough to realise 
that they're XBM format.

?

PJDM
172.10still think Netscape is peaking at the data streamHNDYMN::MCCARTHYA Quinn Martin ProductionThu Apr 10 1997 03:0113
>>The bitmap files in .0 and .3 are XBM (X bitmap) format files. Presumably the 

Correct.

>>server is sending them 

I accessed my sample page using file:/  so there was no server in the way.
That was part of the reason I assumed netscape was doing some 
processing on what it got for in-lined images (it has to display them).
Netscape has the ability to display many image formats in-line (ie no help
of an external program).

bjm
172.11Just add it to mime.types!ANGLER::GRENIERThu Apr 10 1997 04:4714
    Just add an entry to your mime.types file for BMP files. Fastrack
    Server on Digital Unix defaults to text/plain for file types that
    it doesn't find in mime.types.  I imagine the NT version is the
    same.  Add something like:
    	type=image/bmp		exts=bmp
    
    ...and restart your server.  I've had to do this many times, so
    that my webserver would not send Word/Powerpoint/etc files as
    plain text.  If you start adding other types of content that
    Fastrack doesn't know about, you'll have to add those mime types
    also.  I recently added mime types for Shockwave Director and
    Futuresplash.
    
    Steve
172.128153::tecotoo.mro.dec.com::mayerDanny MayerThu Apr 10 1997 15:1412
> I accessed my sample page using file:/  so there was no server in the way.
> That was part of the reason I assumed netscape was doing some 
> processing on what it got for in-lined images (it has to display them).
> Netscape has the ability to display many image formats in-line (ie no help
> of an external program).

	Files read using file: protocol use the browser's list of MIME types
  since there is no HTTP header.  This is the same for ftp: protocol.  The
  results you get are different from using http: protocol since the http server
  decides on the MIME type to send in the HTTP header.

		Danny
172.13BMP file formatCIRCUS::GOETZETibetan karma not Made in ChinaWed May 14 1997 00:194
    BMP is common on Windows, but makes for a poor network graphics file
    format. The files are typically huge, and the format O/S-specific. 
    
       erik