refactor card image helper