set language code based on $wgUploadPath, since that contains the language subdirectory files are stored in. This is needed because some wikis have their english images stored in <bucket>/en/images instead of just <bucket>/images/