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

Animated GIF images: the .Width and .Height properties are incorrect when image cache is empty (first run) #11079

Closed
jmooring opened this issue Jun 9, 2023 · 1 comment · Fixed by #11103
Assignees
Milestone

Comments

@jmooring
Copy link
Member

jmooring commented Jun 9, 2023

Reference: https://discourse.gohugo.io/t/44751

Tested with v0.101.0 and v0.113.0. This is not a new bug.

If you have an empty image cache (resources/_gen/images), the .Width and .Height methods return the original dimensions instead of the resized dimensions when you run hugo or hugo server for the first time. Note that the images in the cache (and the published images) are the correct size (i.e., resizing was successful).

If you run hugo or hugo server again (the image cache is not empty) the .Width and .Height methods return the correct (resized) dimensions.

This behavior is limited to animated GIF images. Non-animated GIF images work as expected, as do JPEG, WebP, etc.


Reproducible example (includes an animated GIF and a non-animated GIF):

git clone --single-branch -b hugo-forum-topic-44751 https://github.com/jmooring/hugo-testing hugo-forum-topic-44751
cd hugo-forum-topic-44751
rm -rf resources/_gen/images/ && hugo server

Then stop the server, and restart without clearing the image cache:

hugo server
@bep bep removed the NeedsTriage label Jun 14, 2023
@bep bep self-assigned this Jun 14, 2023
@bep bep added this to the v0.114.0 milestone Jun 14, 2023
bep added a commit to bep/hugo that referenced this issue Jun 14, 2023
bep added a commit that referenced this issue Jun 14, 2023
@github-actions
Copy link

github-actions bot commented Jul 6, 2023

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 Jul 6, 2023
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