scale and cache images