rework image caching to work without permanent article content rewriting (refs #582)