Closed pakogn closed 1 month ago
A workaround is to add fit="crop_focal"
to the glide
tag. Then the focal point will be part of the URL and will change appropriately.
This will be handled properly as part of #10204. Presets will be expanded on the URLs rather than having p=featured
in the URL.
Great! thanks, @jasonvarga
When doing this, the images still cached?
I opted for something like this:
@foreach (Statamic::tag('glide:generate')->src($post->featured_image)->filename($post->featured_image->basename)->preset('featured') as $image)
<img loading="lazy" src="{{ url($image['url']) }}&{{ urlencode(base64_encode("{$image['focus']}")) }}" height="300" width="100%" alt="{{ $post->featured_image->alt }}" title="{{ $post->featured_image_titulo }}" />
@endforeach
Appending the focus to the url doesn't break the signature and keep serving the generated image that lives in storage/statamic/glide/containers/etc...
Bug description
While working with glide:generate and presets I noticed that when the focal point is changed the URL stays the same.
domain.com/img/asset/dXBsb2Fkcy9wb3J0YWRhLWd1aWxsZXJtby0oMykuanBn/portada-guillermo-%283%29.jpg?p=thumbnail_condensed&s=e4112fd8e82a25bf0fcaffb0a3df9981
The expected behavior would be to change so Editors can watch the updated image with the new focal point. Because the URL doesn't change the browser cache it and doesn't allow to watch the updated one.
I saw that the url uses a signature based on the path so maybe to considerate the focal point in the signature could be a solution.
How to reproduce
Logs
No response
Environment
Installation
Fresh statamic/statamic site via CLI
Additional details
No response