Option to turn off tall image cropping


(David Kingham) #1

Going back to this feature request

I would like to have the option to turn this off, our forum is centered around photography and we do not want images to be cropped, I’ve already ran into some instances where an image with an unusual ratio was cropped even though it wasn’t that tall. I’d rather have no cropping so we always see the full image.


(Mittineague) #2

So you’re saying you would rather they be resized to fit in a post? You don’t anticipate any possible problem with there being small-width images?


#3

Yes, it’s a big problem if you have a lot of tall images. Some of them will be cropped some not. Quite unpredictable and annoying. It’s a part of the problem with how lightboxing works.


(David Kingham) #4

Not in my particular forum, no. Photographs are fairly standard sizes except for some panoramas which are usually wide and not tall. I don’t foresee any tall screenshots being posted, just photographs. Retaining the entire image in the thumbnail is my top priority.


(Mittineague) #5

I have a feeling this wouldn’t be so easy.

Background images can have an object-fit property of contain

contain

The replaced content is scaled to maintain its aspect ratio while fitting within the element’s content box. The entire object is made to fill the box, while preserving its aspect ratio, so the object will be “letterboxed” if its aspect ratio does not match the aspect ratio of the box.

But that isn’t for non-replaced images.

Although the raison d’être of Discourse is discussion and not an image gallery, I think this has come up often enough that a good Pull Request has a good chance of being considered. If not that, a plugin for those that wanted the option to either crop or resize images would get a few takers.

Have you been trying anything that has potential that you’re willing to share?


(David Kingham) #6

I’m not trying to make an image gallery, but create discussions around photographs (critiques, etc.), having images display in their entirety is absolutely critical to foster the discussion.

I am not a programmer so I have no input, just providing the ideas to improve the forums for certain users.


(Mittineague) #7

That’s a shame. When the person wanting a feature is the one writing the code there is no problem understanding what the desired specifications are. When different, the specifications most often need to be “teased out” and all too often the goal post keeps moving.

Are you experienced with making mock-ups? They can go a long way in making it clear what end result is desired.

Even if you don’t know what programming might be needed, it would be best for you to make a list of details that is as complete as you can muster.

Because images are important to you, I’m assuming you’re more knowledgeable than I about what properties you want to preserve and which you’re willing to compromise. My take of “turn off cropping for tall images” is that you would like to have either a site-wide, or likely preferable per-post, setting. And that this setting would give the choice for the initial display (initial because they can be click-through to larger size better quality images) to either display in the container element preserving pixel quality at the expense of losing aspect ratio (cropped) or to preserve aspect ratio at the expense of losing pixel quality (resize).

Though not easy, I think the easier approach would be to have site-wide settings unless users lean towards being “techy”. In any case, I think there would need to be a list of “when this, then this” scenarios for programmers to work from. eg.

  • when both the height and width are less or equal to the display area, display the original image
  • when the height is <= display area but the width is greater crop or resize and letterbox
  • same for when the width is <= but the height is greater
  • when the image is both taller and wider than the display area … ?
  • is the post-upload processing the same regardless of aspect ratio, any range of lengths, image type?
  • when cropped, what area is to be used. top left, center?
  • etc. etc.

The more detailed you can be about the specifications the more likely the code will be able to be worked up. Then it’s only a matter of a programmer being sufficiently motivated to write the code. eg. similar interest, financial compensation,


(David Kingham) #8

Maybe I am thinking this is too simplistic, but in the original request to have this turned on @zogstrip said:

But @codinghorror put the kibosh on having the option.

Mad respect for Jeff, but I want it turned off :slight_smile:

I simply want the option of turning the cropping off sitewide as it was before that change. The image would still respect the max image height and width settings. I do not see our user base ever posting super long images like screenshots so we simply do not want this.

An example of how it works now with cropping:

And how I would like it to look:


(Jeff Atwood) #9

Is this ratio configurable via a site setting @zogstrip?


(Mittineague) #10

Thanks for the screen captures, that helps a lot.

Using a mini version to demonstrate original, cropped, resized
eiffel-full . eiffel-crop . eiffel-resize

What you mean by “don’t crop an image so it fits in the display area” is not “resize an image so it fits in the display area” but “increase the display area to hold larger images”

Without some limits in place, this would introduce a risk of needing scroll, especially problematic for wide images needing horizontal scroll, but also potentially with vertical scroll as well.

Speaking of scroll, how would putting overflow scroll on the image container and not the page work for you?


(David Kingham) #11

The image would be resized as it is now but simply not cropped. As I stated the image would still follow the max image height/width rules in settings. So, for example, this image I intentionally cropped to be very narrow, it’s almost 5000px tall, I’d like it to be resized to be only 500px tall in the thumbnail as per max_image_height setting so the whole image is shown with no scrolling necessary. I don’t care if it’s super narrow because we never have images like this, just an extreme example to get the point across.


(David Kingham) #12

I don’t want that, I want to see this (I resized to 500px high)
image


(Jeff Atwood) #13

To clarify this should be on by default but I do not oppose a site setting to define the ratio of height to width where it is triggered @zogstrip


(Régis Hanol) #14

It’s now a site setting :tada:

@davidkingham wait for the build to pass, update to latest and set “min ratio to crop” to 0 :wink: