Feature Request: Tall and Thin Image Handling

I think this is a feature request. We have users putting images in posts, and sometimes those images are quite tall, i.e. height much greater than the width. Discourse provides an image preview in the post, but uses the image height within the post height to determine the aspect ratio. An example image looks like this:

Ideally we’d like to present this image so that the image width takes the full post width, but perhaps shows a ‘More…’ link at the bottom. The ‘image viewer overlay’ (not sure what type, mfp css classes) struggles with this format too, in that it squishes the file info at the bottom.

So yep, probably a bit unusual but thought I’d throw that out there anyway. If anyone has any simple custom CSS then we could give that a go too.

8 Likes

we have the same problem-- I’d love to see this addressed

1 Like

I am also interested in this @zogstrip, I think we need special handling of very tall images. Maybe the thumbnail crops them at a certain height to prevent crazy super-mega-tall thumbnails with bizarre height to width ratios, as in, way too tall?

5 Likes

@zogstrip is working on this but it turned out to be harder than we expected. :muscle:

4 Likes

I really like the way RES handles this.

The comics at /r/polandball are a textbook example of such tall images.

3 Likes

Took me longer than anticipated because I went the wrong way trying to solve this. Left it on the backburner for a few days before going back to it with another approach :wink:

There’s now a new site setting: crop_tall_images which is enabled by default and will generate a crop of tall images instead of generating a thin thumbnail.

https://github.com/discourse/discourse/commit/667dd54a23b705d4286ac0b2a8d398c13675963b

5 Likes

Why ever disable this? Does it really need a site setting? It seems like such a net positive that I can’t imagine it ever needing it to be disabled?

2 Likes

Might be a bit of imagineering on my part but there might be art/design/photo-heavy communities who might not want to crop their images and instead increased the maximum height.

It’s only 2 ifs so it’s an easy change if we need to remove it.

I know, 3 “might” in the same sentence is definitely leaning towards imageerining…

I suggest we wait for that request rather than adding another site setting Because We Can.

1 Like

https://github.com/discourse/discourse/commit/32d253d484327e4880c1097d03747f0919edebcb

 

10 Likes

Let’s see if it works!

Yes! Amazing! Well done @zogstrip :kiss: :flag_fr: :frog: :poodle:

9 Likes

Something’s not right in the top image of this post:

I’m confused now. Is this intended behaviour? I guess I’m clamouring for this now?

I’m actually tweaking the ratio used to trigger the crop. Will change it so that iPhone 6 screenshot don’t crop :wink:

https://github.com/discourse/discourse/commit/ebd4b4577168644ff1132af85215bfa2034ecdbb

2 Likes