Image caching

I've added image-caching, but not sure this is ready for merge, as the code is impossible to test on Windows. Same culprit as in Rupture, invalid newline characters:

(This error occurs for all tests)
![pic](http://puu.sh/6peNN.png)