Added image caching to tmp file