Conditionally returning images for cache control