I think I got SAVE_CACHED_IMAGES
in Statamic wrong the whole time. I thought it’s about whether Glide-generated images are kept when clearing caches. Assuming I got it right, this is what it really does:
When set to true
:
- All image presets defined in
assets.php
will be generated on upload.
- All Glide image variants referenced on a page will be generated on initial page load.
- All Glide variants required anywhere will be generated when warming the static cache.
- Image variants are stored in
/uploads/img/containers/
.
When set to false
:
- All image presets defined in
assets.php
will still be generated on upload.
- Only the images requested by the browser will be generated and cached.
- Image variants are stored in
/storage/statamic/glide/containers
.
Generated Glide variants are never wiped by clearing the application cache, no matter how SAVE_CACHED_IMAGES
is set.
Consequences
Setting SAVE_CACHED_IMAGES
to false
:
- Will make initial loading times for pages with new images faster, because only the image in the format and resolution as requested by the browser will be generated (and cached for subsequent requests), not all sizes and formats referenced in markup.
- Uploading new images in the panel will be faster because asset presets won’t be generated.
- Less storage will be needed because when set to
true
lots of images are generated and potentially never used.