|||

What Statamic’s SAVE_CACHED_IMAGES really does

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.
Up next Setting Up Job Scheduling in Statamic If a Job implements ShouldQueue the Job will be automatically added to the queue (as do both Shopify Statamic and Statamic Peak|Peak Social Image Pont de l’Abîme
Latest posts Back to MyMind Sending Articles from Feedbin to Readwise Reader In Praise of Sublime App Why I Ended Up Using Todoist Yet Again Pros and Cons of Reflect Notes App A Love Letter to Sublime Internet Lazy.so is an amazing tool. Here's why I don't keep it Carl Sagan has shown the absurdity of not acting against climate change back in 1990 A success message that communicates the opposite of success Epomaker TH80 Pro Polyamor, aber mit PKM apps 🫣 Ironie, die Fabi Rommel Helft der Natur Tiny Garden Paradise Schwiegerfuchs Same Vibe Tailwind and Web Craftsmanship Buttons with CSS Expand Basic Markdown Formatting in Apple Notes Cannot Divide by Zero in Peak Picture Partial Applying a Growth Mindset (Doodle) Using the AVIF format for CSS background images Workaround for Email Validation Issue in Statamic A First Quick Look at Cosmos.so – and Why I'll Stick with MyMind Install a Starter Kit from local repo to get the latest Peak working in Statamic 4 beta Set sensible validations for Statamic image uploads Render first heading inside Statamic Page Builder as `h1` My PKM App Stack for 2023 Favorite apps in recent weeks: mymind & Craft First List Item inside CSS Multi Column Layout is offset