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

Issue with image scaling from shortcodes #4202

Closed
bep opened this issue Dec 31, 2017 · 16 comments
Closed

Issue with image scaling from shortcodes #4202

bep opened this issue Dec 31, 2017 · 16 comments
Assignees
Milestone

Comments

@bep
Copy link
Member

bep commented Dec 31, 2017

There is a dependency issue there; it works if you trigger a second build. This would probably work if we use the source instead of the published image as source, which also makes more sense.

See https://discourse.gohugo.io/t/hugo-0-32-related-questions-discussions/9770/3

@bep bep self-assigned this Dec 31, 2017
@bep bep added the Bug label Dec 31, 2017
@bep bep added this to the v0.32.1 milestone Dec 31, 2017
bep added a commit to bep/hugo that referenced this issue Jan 1, 2018
@bep
Copy link
Member Author

bep commented Jan 1, 2018

I have looked into this and tried to add a failing test for it. The issue isn't what I thought initially; seems to be some kind of race where it doesn't fail all of the time. I will have to look into this more closely. In fact, I can not reproduce it at all at the moment.

@bep
Copy link
Member Author

bep commented Jan 1, 2018

Never mind, I can reproduce it now.

@bep bep closed this as completed in 16e1d99 Jan 1, 2018
@bep
Copy link
Member Author

bep commented Jan 1, 2018

@RickCogley I will cut a release with a patch for this tomorrow -- this should be clear-cut, but you could give it a spin if you want.

bep added a commit that referenced this issue Jan 1, 2018
Source and destination will be the same when this happens, but it should be correct.

See #4202
@RickCogley
Copy link
Contributor

RickCogley commented Jan 1, 2018 via email

@RickCogley
Copy link
Contributor

RickCogley commented Jan 2, 2018

Ok @bep, happy new year, and I tested after compiling.

This time it still required two runs after I updated the post in question, but, it did work. What I did:

  • added back the delete commands in my deploy script, so that the source folder gets deleted completely before it's sent to the server via rsync
  • updated the post with the image resource (changed tags, updated date, nothing to do with the resource image itself)
  • git commit and push
  • published using my script
  • confirmed the post, but the shortcode is broken again, so that bit of html is broken on the published page
  • re-published using my script
  • confirmed again, and this time the html appears fine
  • look at git status, and notice that the image has been regenerated, and is appearing as "untracked"

Anyway, it appears to work somehow. I'll let you know what else I see if anything.

Thanks again.
Rick

Hugo Static Site Generator v0.33-DEV-3DD8C1C0 darwin/amd64 BuildDate: 2018-01-02T20:09:15+09:00
GOOS="darwin"
GOARCH="amd64"
GOVERSION="go1.9.2"

@RickCogley
Copy link
Contributor

@bep sorry. After I added back the delete lines, I did not re-source .zshrc so it is likely that my deploy script was still not deleting. I restarted my terminal, to be sure .zshrc would reload, and tried again. This time, no problem after refreshing the post again (script fully deleted the source folder before the rsync); the published post appears normal.

@bep
Copy link
Member Author

bep commented Jan 2, 2018

Thanks. I have also added some shortcode examples here:

https://gohugo.io/about/new-in-032/#image-processing-examples

@RickCogley
Copy link
Contributor

cool! I'll use your shortcode so I can learn something from it. :-)

@bep
Copy link
Member Author

bep commented Jan 2, 2018

cool! I'll use your shortcode so I can learn something from it. :-)

The scratch construct is "uglish", but that will improve when this is fixed (Go 1.11):

golang/go#10608

@jensamunch
Copy link

Hi Bep!

I am so incredibly excited about this update! Doing images in this way changes everything!
So I threw myself at this fix but still getting errors when deploying to Netlify..

Locally hugo -v throws no errors..any thoughts?

screen shot 2018-01-02 at 13 55 51

@bep
Copy link
Member Author

bep commented Jan 2, 2018

Locally hugo -v throws no errors..any thoughts?

Yes; I just tested with the Hugo docs when deleting the resources folder. I didn't test this good enough :-) And I'm not totally sure what happens, either, but I'll reopen this and have another look.

The workaround for Netlify is, I think, to build locally and commit your resources folder to your Git repo (which is the recommended workflow in any case).

@bep bep reopened this Jan 2, 2018
@bep
Copy link
Member Author

bep commented Jan 2, 2018

See #4213

@bep bep closed this as completed Jan 2, 2018
@bep
Copy link
Member Author

bep commented Jan 3, 2018

@jensamunch this is now fixed in 0.32.2. I have verified it on Netlify here: https://next--gohugoio.netlify.com/about/new-in-032/ ... i.e. I deleted the /resource dir from the GitHub repo; I would, however, recommend that you commit that folder to Git as it will make the builds much faster.

@jensamunch
Copy link

amazing @bep - i just can't believe what you've done with this project!

@saiarung27
Copy link

screen shot 2018-01-24 at 2 34 27 pm

I am getting same error please help me out altough i am using latest version

@github-actions
Copy link

github-actions bot commented Mar 8, 2022

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 Mar 8, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

4 participants