From df9b4ee4c640c8bf0407d600012e7331795c657d Mon Sep 17 00:00:00 2001 From: Steven Date: Wed, 28 Oct 2020 12:00:49 -0400 Subject: [PATCH 1/4] Update docs with details for cached images --- docs/basic-features/image-optimization.md | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/docs/basic-features/image-optimization.md b/docs/basic-features/image-optimization.md index 1184c331c0de8..4a8804d933094 100644 --- a/docs/basic-features/image-optimization.md +++ b/docs/basic-features/image-optimization.md @@ -122,11 +122,19 @@ module.exports = { The following Image Optimization cloud providers are supported: - When using `next start` or a custom server image optimization works automatically. -- [Vercel](https://vercel.com): Works automatically when you deploy on Vercel +- [Vercel](https://vercel.com): Works automatically when you deploy on Vercel, no configuration necessary. - [Imgix](https://www.imgix.com): `loader: 'imgix'` - [Cloudinary](https://cloudinary.com): `loader: 'cloudinary'` - [Akamai](https://www.akamai.com): `loader: 'akamai'` +## Caching + +Images are optimzed dynamically when requested and stored in the `/cache/images` directory. The optimized image file will be served for subsequent requests until the expiration is reached. When a request is made that matches a cached but expired file, the cached file is deleted before generating a new optimize image and caching the new file. + +The expiration (or rather Max Age) is defined by the upstream server's `Cache-Control` header. + +If `s-maxage` is found in `Cache-Control`, it is used. If no `s-maxage` is found, then `max-age` is used. If no `max-age` is found, then 60 seconds is used. + ## Related For more information on what to do next, we recommend the following sections: From 84905282ae7a1b5d20e49a4a6947686012633bb2 Mon Sep 17 00:00:00 2001 From: Steven Date: Wed, 28 Oct 2020 12:04:44 -0400 Subject: [PATCH 2/4] Disclose this is default loader only --- docs/basic-features/image-optimization.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/docs/basic-features/image-optimization.md b/docs/basic-features/image-optimization.md index 4a8804d933094..829b589c1900a 100644 --- a/docs/basic-features/image-optimization.md +++ b/docs/basic-features/image-optimization.md @@ -129,6 +129,8 @@ The following Image Optimization cloud providers are supported: ## Caching +The following describes the caching algorithm for the default [loader](#loader). For all other loaders, please refer to your cloud provider documentation. + Images are optimzed dynamically when requested and stored in the `/cache/images` directory. The optimized image file will be served for subsequent requests until the expiration is reached. When a request is made that matches a cached but expired file, the cached file is deleted before generating a new optimize image and caching the new file. The expiration (or rather Max Age) is defined by the upstream server's `Cache-Control` header. From 61b7602c01aaf4fdf940f81dfe12f0e92b55a0ac Mon Sep 17 00:00:00 2001 From: Steven Date: Wed, 28 Oct 2020 12:12:33 -0400 Subject: [PATCH 3/4] Mention `deviceSizes` --- docs/basic-features/image-optimization.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/docs/basic-features/image-optimization.md b/docs/basic-features/image-optimization.md index 829b589c1900a..573311cf92c4b 100644 --- a/docs/basic-features/image-optimization.md +++ b/docs/basic-features/image-optimization.md @@ -137,6 +137,8 @@ The expiration (or rather Max Age) is defined by the upstream server's `Cache-Co If `s-maxage` is found in `Cache-Control`, it is used. If no `s-maxage` is found, then `max-age` is used. If no `max-age` is found, then 60 seconds is used. +You can configure [`deviceSizes`](#device-sizes) to reduce the total number of possible generated images. + ## Related For more information on what to do next, we recommend the following sections: From 8ff0824e638df9d4216363062c1349dc613def04 Mon Sep 17 00:00:00 2001 From: Steven Date: Wed, 28 Oct 2020 12:16:55 -0400 Subject: [PATCH 4/4] Fix typos --- docs/basic-features/image-optimization.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/basic-features/image-optimization.md b/docs/basic-features/image-optimization.md index 573311cf92c4b..3dbf5d2f9e743 100644 --- a/docs/basic-features/image-optimization.md +++ b/docs/basic-features/image-optimization.md @@ -129,9 +129,9 @@ The following Image Optimization cloud providers are supported: ## Caching -The following describes the caching algorithm for the default [loader](#loader). For all other loaders, please refer to your cloud provider documentation. +The following describes the caching algorithm for the default [loader](#loader). For all other loaders, please refer to your cloud provider's documentation. -Images are optimzed dynamically when requested and stored in the `/cache/images` directory. The optimized image file will be served for subsequent requests until the expiration is reached. When a request is made that matches a cached but expired file, the cached file is deleted before generating a new optimize image and caching the new file. +Images are optimized dynamically upon request and stored in the `/cache/images` directory. The optimized image file will be served for subsequent requests until the expiration is reached. When a request is made that matches a cached but expired file, the cached file is deleted before generating a new optimized image and caching the new file. The expiration (or rather Max Age) is defined by the upstream server's `Cache-Control` header.