kc0bfv / autophugo

AutoPhugo [ˌɔtoʊˈfjuːgəʊ] is a gallery/photoblog theme for Hugo that's a little more automatic than Phugo.
Other
97 stars 56 forks source link

Replacing width by max_width and max_length parameters #35

Closed ghost closed 2 years ago

ghost commented 2 years ago

Only being able to specify a fixed width means vertical images end up disproportionately tall compared to their horizontal counterparts in albums mixing both. AutoPhugo should instead use maximum resolution parameters to ensure coherence.

kc0bfv commented 2 years ago

I understand what the first sentence means, I'm not sure what the second sentence means. For the way the albums display it's important that every image (at least, as displayed in the album) have the same width - that way they can fit in columns that flow nicely.

ghost commented 2 years ago

Right sorry, I'm talking about the full size images loaded by the gallery. This is not about how they're displayed, this is about the resolution they're generated in.

kc0bfv commented 2 years ago

So - if I generate something 1000 px wide x 10000 px tall, then add that to an album with horizontal pictures, the thumbnail view is very tall. It's like - 10 times taller than the other images. If I click on it to view it full sized, it is very narrow on the screen but the entire height is present.

This is basically the intended behavior right now. Thumbnails aren't currently set to get cut-off beyond some height, and full size images should show on the screen entirely... This looks bad with an extremely tall photo, but I think it's tough to automatically determine what to do in those cases, and I think autodetection will work for some users and look bad for others... So I don't want to do that. Adding custom code to handle specific cases is possible, and it would involve adding additional frontmatter options and handling them... There's probably a version of that which can be included in the "everybody" release.

I'm not sure I'm understanding what your suggestion is though. If you have an example site where things aren't working how you'd like, that would help... And if you have a screenshot of that undesired example and you edit it to show what you desire instead, that might help.

kc0bfv commented 2 years ago

Ok - thinking about this just slightly more - I think I understand that your issue is:

If you have an image that's say, 100x1000, then the full-sized image will resize to 960x9600. And that's just nuts, and you'd prefer to be able to set a max_height like 4000, and then it would scale to 400x4000 because otherwise it'd bust the max_height.

I might be able to do this with the "fit" method instead of hugo's "resize".

kc0bfv commented 2 years ago

I added an "advanced feature", documented in the Readme, that lets you tell Autophugo to use "Fit" instead of "Resize", in hugo's image processing functions.

https://gohugo.io/content-management/image-processing/

If you change to fit you can specify the max height and width, and if the image is larger than either it'll get scaled down to a max. It won't get scaled up... You can do that site wide or in a subalbum frontmatter. If you switch to "fit" you must also specify the "full_size" string - which is the other advanced feature I added a while ago.

Currently on the cur_release branch, will get to main soon.

kc0bfv commented 2 years ago

Let me know if this is not what you meant, but I think now I understand and I think this is what you meant. Hugo's image processing functions are a little limited (they're impressive because they're present, but still they're not like, Gimp).

ghost commented 2 years ago

Fantastic! It is exactly what I meant, thank you very much! Just saying "fit" probably would have made this much more obvious, sorry!