refactor offline upload image