Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Glide handles images on public disk via the http route #11371

Open
marcorieser opened this issue Jan 19, 2025 · 0 comments · May be fixed by #11372
Open

Glide handles images on public disk via the http route #11371

marcorieser opened this issue Jan 19, 2025 · 0 comments · May be fixed by #11372
Labels

Comments

@marcorieser
Copy link
Contributor

marcorieser commented Jan 19, 2025

Bug description

We use the default public disk for storing assets, assign them with an assets field to an entry and manipulate them with Glide. We noticed that Glide handles the assets via the http route like external images. This is not ideal because these listeners clear the Glide cache only for the asset route. This means e.g. that changing the focal point deletes and rebuilds the cached images in storage/statamic/glide/containers but in the frontend, the images are cached in storage/statamic/glide/http. Therefore the new focus point does not show up in the frontend.

We can fix that by removing env('APP_URL') from the url for the public disk in config/filesystems.php:

'public' => [
    'driver' => 'local',
    'root' => storage_path('app/public'),
    'url' => '/storage', // env('APP_URL').'/storage'
    'visibility' => 'public',
    'throw' => false,
],

However, it would be cool if Glide could check if the image gets served from the same URL, so the above change would not be necessary and it would work with standard Laravel.

How to reproduce

  1. Use the public disk for the assets container
  2. Add an assets field images to the pages blueprint
  3. Link an image to an entry
  4. Add {{ images }}{{ glide:url format="webp" }}{{ /images }} to your view
  5. Note that the URL starts with /img/http instead of /img/asset

Environment

Environment
Application Name: Statamic
Laravel Version: 11.38.2
PHP Version: 8.3.16
Composer Version: 2.8.4
Environment: local
Debug Mode: ENABLED
URL: statamic-glide-tinker.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

Statamic
Addons: 0
Sites: 1
Stache Watcher: Enabled (auto)
Static Caching: Disabled
Version: 5.45.1 PRO

Installation

Fresh statamic/statamic site via CLI

Additional details

No response

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants