Skip to content

[4.x] URL is not regenerated when working with presets and focal point changes #10899

@pakogn

Description

@pakogn

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

  • configure a preset in config/assets.php:
'featured' => ['w' => 850, 'h' => 480, 'q' => 90, 'fit' => 'crop_focal'],
  • with a "featured_image" asset field in an entry show the entry image in a view 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']) }}" height="300" width="100%" alt="{{ $post->featured_image->alt }}" title="{{ $post->portada_titulo }}" />
@endforeach

Logs

No response

Environment

Statamic v4.58.2, even have tested this in v5.30.0

Laravel Version: 9.52.16
PHP Version: 8.2.24
Composer Version: 2.5.3

Installation

Fresh statamic/statamic site via CLI

Additional details

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions