Fix image handler to support remote ids.