Implement rewriting of references for quoted images.