Factored out CachedImage wrapper.