-
Hi. I am new to hugo and would like to change the partial "list-item.html" of your theme so that it lets create Hugo thumbnail images for the featured image in the page list. There are some width and height parameters(?) in partials/helpers/image.html of your theme but I couldn't find out how to pass height and or width to the helper. Currently list-item.html uses the original files with in small size which are 1 MiB+ each in my blog. Could you please help? Thank you. |
Beta Was this translation helpful? Give feedback.
Replies: 7 comments 13 replies
-
See also Resizing Images. For example(front matter): images = [
"images/center.png?width=180px"
] |
Beta Was this translation helpful? Give feedback.
-
As far as I understood the initial question, Natenom wants to have several differently sized images - for example: a small one for the list, a medium sized one for the post and an original sized one for the image viewer. Passing height and width as parameters results in the same sizes everywhere, and it is still the fullsize image being delivered. Something like this in the shortcode:
This way the list only uses small sized thumbnail images and creates less network traffic. |
Beta Was this translation helpful? Give feedback.
-
Jepp, thats what I meant. Currently the article images are always the full size images. That not efficient if the image is ~1 MiB large. The theme should handle that automatically for the featured image. Of course one could create a small image for every post but that seems not to be a nice solution when using a something that could do that automatically. :) |
Beta Was this translation helpful? Give feedback.
-
Sounds good, I'll think about it after solving the #368. |
Beta Was this translation helpful? Give feedback.
-
@Natenom Since we changed the look up order of thumbnails #357, I've been thinking about it, but I couldn't find a way to shrink a large image automatically. Please feel free to share your ideas if you find some. |
Beta Was this translation helpful? Give feedback.
-
I created a simple version #393, currently the thumbnails will be resized with |
Beta Was this translation helpful? Give feedback.
-
@razonyang I am in the process of renaming images in my content directory to featured* to get this to work.
(depending on 2:3 or 3:4 it is 240 instead of 270) If you change the resize params to 180x180 the largest dimension gets chosen and both orientations end up 180x120 respectively 120x180. |
Beta Was this translation helpful? Give feedback.
I created a simple version #393, currently the thumbnails will be resized with
180
width automatically, and the image viewer will show the original thumbnails on click. As for the image's size on the post content(detail) page, it's hard to define the proper size of images, it can be easy to resize byheight
andwidth
parameters, I think it won't be a big problem.