Extension lookup map; add gif and bmp

Uses two maps for whitelisting extensions and mimetypes, and for looking up extensions by mimetype without redundant hardcoding.

`gif` and `bmp` added to mimetypes.