ssg icon indicating copy to clipboard operation
ssg copied to clipboard

glide:data_url fails without a full glide image cache

Open rikh42 opened this issue 5 months ago • 0 comments

When running the static site generator, glide images are generated directly in storage/app/static/...., but glide:data_url attempts to read the generated image from storage/statamic/glide.

If you have been viewing the site in a local browser, the cached images will coincidently be present in storage/statamic/glide, creating the illusion that glide:data_url is working. However, if the glide cache is cleared prior to running php please ssg:generate, then errors will be produced and the data urls will be blank.

I added some logging to the filesystem to report every file read and write. Here is an extract from an example project showing the write and following read from different paths.

[2025-07-07 09:57:49] local.INFO: Write File ["/Users/me/dev/clients/example.co.uk/storage/app/static/img/containers/assets/design/logo-design.png/24f5efe8bef890830bfe16b2d1cba72d/logo-design.webp"] 
[2025-07-07 09:57:49] local.INFO: read file ["/Users/me/dev/clients/example.co.uk/storage/statamic/glide/containers/assets/design/logo-design.png/24f5efe8bef890830bfe16b2d1cba72d/logo-design.webp"] 
[2025-07-07 09:57:49] local.ERROR: Unable to read file from location: containers/assets/design/logo-design.png/24f5efe8bef890830bfe16b2d1cba72d/logo-design.webp.  

Steps to reproduce.

  1. Add a {{ glide:data_url }} tag to an antlers view
  2. php please glide:clear
  3. php please ssg:generate
  4. Notice that there is no data url in the generated html files
  5. Notice the error 'Unable to read file from location: ' in the Laravel log file

Support details

Environment Application Name: Example Laravel Version: 12.19.3 PHP Version: 8.4.8 Composer Version: 2.8.9 Environment: local Debug Mode: ENABLED URL: example.test Maintenance Mode: OFF Timezone: UTC Locale: en

Cache Config: NOT CACHED Events: NOT CACHED Routes: NOT CACHED Views: CACHED

Drivers Broadcasting: log Cache: file Database: sqlite Logs: stack / single Mail: log Queue: sync Session: file

Storage public/storage: NOT LINKED

Statamic Addons: 2 Sites: 1 Stache Watcher: Enabled (auto) Static Caching: Disabled Version: 5.58.1 Solo

Statamic Addons statamic/seo-pro: 6.7.0 statamic/ssg: 3.1.1

rikh42 avatar Jul 07 '25 10:07 rikh42