Removed one call to lower, which cause bugs when there was name collision for wikia url
Fixed jpg bug when attempting to reformat images and reorganised the type generation code so it is much more efficient. It no longer loops through all of the extensions and now intellegiently figures out which extension to use based of the URL