Image path does not update when setting a new crop.

Created on 16 July 2025, 12 days ago

Hey, first of all, thanks for this module, which fills a fundamental gap. Unfortunately, I can't get it to run correctly.

After I have saved a new crop on an image, the itok token of the path does not change. As a result, the image is of course not reloaded after the crop has been changed. (The browser cache does not load it because the URL/itok does not change)

The token is created in /src/MediaContextualCropService.php : 203 and is based on the original image style. So as long as the non-contextual derivative has not been changed, this token will always remain the same.

Have I configured something wrong or can someone else confirm this?

🐛 Bug report
Status

Active

Version

2.1

Component

Code

Created by

🇩🇪Germany hauke-vq Berlin, Germany

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

  • Issue created by @hauke-vq
  • 🇩🇪Germany hauke-vq Berlin, Germany

    Oh no. I've just realised that I got that wrong. Without Contextual Crop, I have an additional query parameter that updates when a crop is made. This does not exist on contextual cropped images.

    I'm not very experienced with backend programming, so this is a bit difficult for me to figure out.

  • 🇫🇷France DrDam

    That's a main issue

    Can you be more precise with the site configuration (modules involved, configuration on image styles....), URL generated, some screen-shots...

    Thanks

  • 🇩🇪Germany hauke-vq Berlin, Germany

    I have written a patch that solves my problem. But I am not completely sure if it is the correct approach.

    I'll try to summarise the problem again:

    For non-context-based crops, the URLs to the image styles have an additional query paramter ‘h’. This updates itself based on the crop and serves as a cache breaker for browsers/CDNs because the actual URL does not change.

Production build 0.71.5 2024