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

Changed imaging config not reflected in the cache hash for some image filters #13272

Closed
bep opened this issue Jan 16, 2025 · 4 comments · Fixed by #13274
Closed

Changed imaging config not reflected in the cache hash for some image filters #13272

bep opened this issue Jan 16, 2025 · 4 comments · Fixed by #13274
Assignees
Milestone

Comments

@bep
Copy link
Member

bep commented Jan 16, 2025

I'm pretty sure this isn't true in general for the image resize methods etc., which is probably why I haven't seen this, but if you e.g. only apply images.Mask to an image, this becomes an issue.

I just tried to change the bgColor in hugo.toml for http://localhost:1313/functions/images/mask/, but the change wasn't reflected until I cleared the image cache.

@bep bep added the Bug label Jan 16, 2025
@bep bep added this to the v0.142.0 milestone Jan 16, 2025
@bep bep self-assigned this Jan 16, 2025
@jmooring
Copy link
Member

While updating the docs yesterday I tried a few different mask images... all with the same name (mask.png). I had to clear the image cache to see the changes. I was guessing that the hash did not include the mask content, just its original file name. But maybe there's something else going on.

@bep
Copy link
Member Author

bep commented Jan 16, 2025

I was guessing that the hash did not include the mask content, just its original file name. But maybe there's something else going on.

I'm taking this from memory, but for the resize ops (including imaging.Process) we add the global image config to the hash. I'm guessing this somehow got lost when we added other filters. For most of them this isn't an issue (they don't depend on global config), but images.Mask do (bgColor). Anyhow, i will have a look and fix this.

@bep
Copy link
Member Author

bep commented Jan 16, 2025

While updating the docs yesterday I tried a few different mask images... all with the same name (mask.png).

OK, I didn't read your post, but the above is a different issue; which looks like a bug with the images.Mask filter. I'll create a separate issue for this.

@bep bep modified the milestones: v0.142.0, v0.141.1 Jan 16, 2025
bep added a commit to bep/hugo that referenced this issue Jan 16, 2025

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
* Always include the content hash in the cache key.
* Always include the image config hash in the cache key.

Fixes gohugoio#13273
Fixes gohugoio#13272
bep added a commit to bep/hugo that referenced this issue Jan 17, 2025
* Always include the content hash in the cache key for unprocessed images.
* Always include the image config hash in the cache key.

This is also a major cleanup/simplification of the implementation in this area.

Note that this, unfortunately, forces new hashes/filenames for generated images.

Fixes gohugoio#13273
Fixes gohugoio#13272
bep added a commit to bep/hugo that referenced this issue Jan 17, 2025
* Always include the content hash in the cache key for unprocessed images.
* Always include the image config hash in the cache key.

This is also a major cleanup/simplification of the implementation in this area.

Note that this, unfortunately, forces new hashes/filenames for generated images.

Fixes gohugoio#13273
Fixes gohugoio#13272
bep added a commit to bep/hugo that referenced this issue Jan 17, 2025
* Always include the content hash in the cache key for unprocessed images.
* Always include the image config hash in the cache key.

This is also a major cleanup/simplification of the implementation in this area.

Note that this, unfortunately, forces new hashes/filenames for generated images.

Fixes gohugoio#13273
Fixes gohugoio#13272
bep added a commit to bep/hugo that referenced this issue Jan 17, 2025
* Always include the content hash in the cache key for unprocessed images.
* Always include the image config hash in the cache key.

This is also a major cleanup/simplification of the implementation in this area.

Note that this, unfortunately, forces new hashes/filenames for generated images.

Fixes gohugoio#13273
Fixes gohugoio#13272
bep added a commit to bep/hugo that referenced this issue Jan 17, 2025
* Always include the content hash in the cache key for unprocessed images.
* Always include the image config hash in the cache key.

This is also a major cleanup/simplification of the implementation in this area.

Note that this, unfortunately, forces new hashes/filenames for generated images.

Fixes gohugoio#13273
Fixes gohugoio#13272
bep added a commit to bep/hugo that referenced this issue Jan 18, 2025
* Always include the content hash in the cache key for unprocessed images.
* Always include the image config hash in the cache key.

This is also a major cleanup/simplification of the implementation in this area.

Note that this, unfortunately, forces new hashes/filenames for generated images.

Fixes gohugoio#13273
Fixes gohugoio#13272
@bep bep closed this as completed in 1f5a15a Jan 18, 2025
Copy link

github-actions bot commented Feb 9, 2025

This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Feb 9, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants