In the context of image-heavy websites, what are some best practices for optimizing loading times without relying on JavaScript or Flash?

Image-heavy websites can suffer from slow loading times, impacting user experience and SEO rankings. To optimize loading times without relying on JavaScript or Flash, images should be properly compressed and resized, lazy loading can be implemented to load images only when they come into view, and browser caching can be utilized to store images locally for faster retrieval.

// Enable browser caching for images
function add_image_cache_control() {
    header("Cache-Control: max-age=2592000"); // Cache images for 30 days
}
add_action('send_headers', 'add_image_cache_control');