If I have an external an image How to: resize image to width: 800 px; crop it to 2:1 aspect ratio (keeping anchor on the center of the image); and display it with width: 100%?
Before posting this I read couple of times through the docs page on page-bundles. There is one code example and it is pretty complex. I am trying to do something relatively simple. The discussion linked by @lynda is about something else. Not sure how to solve this.Does anybody know how to solve my relatively easy example?
It is impossible to debug the issue you report like this. Please have a look at the Requesting help guidelines.
Then please share the source code of your project (or if you cannot then do replicate it with dummy content).
People in this forum need to see the full context of your templates, especially since you report that a feature that works for most of us doesnβt in your case.
The difference in my case is that I am not debugging my website. I am trying to figure out how to implement a basic functionality.
How to resize an image to width: 800 px; crop it to 2:1 aspect ratio (keeping anchor on the center of the image); and display it with width: 100%?
I am a novice web developer and I read through the docs. They cover complex cases and are really hard to understand for me. I assume this is not only my case. I am building my personal website while trying to figure out Hugo. I hope that my βHugo 101β questions will be helpful to other people who donβt know ins an outs of web development.
We still donβt really know the context of what you want to achieve, so Iβll make some assumptions.
I will assume content structure:
content
βββ posts
βββ _index.md
βββ one
β βββ index.md
βββ two
β βββ index.md
βββ three
β βββ index.md
...
βββ events
βββ _index.md
βββ one
β βββ index.md
βββ two
β βββ index.md
βββ three
β βββ index.md
...
You mention your list.html layout. Iβm assuming you want to list the individual posts.
Does each content piece (ie each post or each event) have its own related image?
Is it just one image for the whole section? I.e. one image for post, a different image for events
Is it the same image regardless of where you are in the site? I.e. a logo image that is the same no matter where you are in your site.
How many images do you have in each context? For example, in case #1, say you have multiple images for posts/one/sunflowers.jpg and roses.png, do you want all of them displayed in your list? Just the first? Do you want to specify which one? Where would you specify which one if so?
Do you want your images transformed in the same way each time? Do you always want 800px width for example?
While the core concepts of Image Processing will be the same, the implementation of it will be slightly different depending on the context.
Say I am writing a post1.md and I want to use the image1-post1.jpg and image2-post1.png within the content of the post (single page).
Also I would like to somehow specify to use image1-post1.jpg on the list page. Can I specify it in the frontmatter of the post?
I want to transform all my images in the same way: width: 800 px; crop it to 2:1 aspect ratio (keeping anchor on the center of the image); and display it with width: 100%.
@pointyfar thanks so much for helping out. Please let me know if everything is clear now.
@pawsys I hope you get the answers you seek. What we are pointing out is: I for one am not going to build a Hugo project from the ground up to figure out a partial configuration. Someone might! But if you built a repo I could clone and have mostly complete, Iβd voluntarily go the rest of the way.
And a lot of folks on the forums have such criteria. For me it is time. Anyhow, good luck, and I hope that explains why we insist on working this way.