Fix for KeyError when Image file raw data is not a valid image

KeyError when doing  >  self.error_messages['invalid_image']