refactor getImage