Feature Request: Tall and Thin Image Handling

(fearlessfrog) #1

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.

Images not getting posted in their full-size when images are extremely tall
Common image uploads sizes cropped
Uploaded picture not scaling-to-fit for mobile
Option to turn off tall image cropping
(lise) #2

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

(Jeff Atwood) #3

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?

(Jeff Atwood) #4

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

(Rafael dos Santos Silva) #5

I really like the way RES handles this.

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

(Régis Hanol) #6

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.

Option to turn off tall image cropping
(Jeff Atwood) #7

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?

Option to turn off tall image cropping
(Régis Hanol) #8

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…

(Jeff Atwood) #9

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

(Régis Hanol) #10


(Jeff Atwood) #11

Let’s see if it works!

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

(Erlend Sogge Heggen) #14

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?

(Régis Hanol) #15

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

Common image uploads sizes cropped
(Erlend Sogge Heggen) #16