Replies: 5 comments 7 replies
-
I had the same problems with hugo at the beginning. Your question about css: https://developer.mozilla.org/en-US/docs/Learn/HTML/Multimedia_and_embedding/Responsive_images#why_cant_we_just_do_this_using_css_or_javascript ATM I resize the image via command line locally. my wip: implement something like this: https://www.mailslurp.com/blog/hugo-responsive-images-srcset/ Best case: user could see direct the result - like https://ghost.org/help/using-the-editor |
Beta Was this translation helpful? Give feedback.
-
Alas I need the huge (well… larger) versions. I’ve started working on a solution to resize on build. |
Beta Was this translation helpful? Give feedback.
-
Made a prototype on the weekend for the resize handleProcessMedia Copy and resize the image and create a thumbnail. Size see config.json Only prototype, not production! |
Beta Was this translation helpful? Give feedback.
-
My two cents here... Image optimization can be difficult to get right, especially when using a responsive design. I do believe image sets are the right approach, at it lets the client (browser) decide which resolution is best. It does require server-side processing, as you'd need the same image in various resolutions (and possibly ratios too). Hugo does a fair bit of caching, however, on larger sites it can still become a bottleneck. (I'm currently using Cloudinary as a Digital Asset Manager to take care of the server-side processing for one of the (commercial) sites I'm working on.) The example that @Ipstenu shared is not fully optimized yet. The
IMHO, the image optimization should be done by preparing a rich image set that caters for most common resolutions and viewport sizes. The |
Beta Was this translation helpful? Give feedback.
-
Already live with same hinode websites? |
Beta Was this translation helpful? Give feedback.
-
Is there a way to define the image dimensions in the shortcode/asset file to make them smaller?
Basically I want to show a grid of thumbnails (say ... 250x250) and have the smaller sized files load first, so my site is.. well ... faster :)
Longer explanation follows :)
I've been working on mini-galleries with lightbox and while I have all the code working for that, I realized that the images aren't being properly resized. Or rather, not resized how I would think.
If you look at https://gethinode.com/docs/content/images-and-figures/ the first image returned the html of
But at its widest, it's really 814px. Now it has
srcset
so that's kind of okay, but not really since it's loading the big image on desktop and that gets real slow.If you look at the example on that page a little further down:
{{< image src="https://picsum.photos/id/56/2880/1920" ratio="1x1" class="rounded" wrapper="mx-auto w-25" >}}
again you get the BIG image:
While the application of the
w-25
wrapper does it's job on render, I found myself wondering why this isn't using that to auto-display a smaller version of the file and save on bandwidth.Beta Was this translation helpful? Give feedback.
All reactions