Connect middleware that resizes images on the fly and caches them