Loader: guess extension from mime type

Try to guess the file extension from the MIME type before checking the URL. If the extension cannot be guessed, then check the URL more accurately by removing the query string and ensuring the server name is skipped (to avoid a file extension of '.com').

This allows the Loader to be used with web services such as the Google Static Maps API.