refactor the image resource