Thumbnail/slideshow issue with small images


#1

When using the ![title|widthxheight](image-url) formatting, thumbnails are generated only when the original image is bigger than certain dimensions.

This is smart but a problem comes when you want to display a gallery in a post.

Here’s an example :

San Agustin

San Agustin 2

If you click on the first image to enlarge it, you can slide through the gallery using the arrow keys .
Unfortunately, 2 of these images don’t show up in the slide show (and their thumbnail is not clickable) because their resolution is below the minimum requirements to generate thumbnails.

A solution to this would be to make images clickable as soon as a custom |widthxheight is used, even if no thumbnail was generated.

Here’s the raw text I used for this little gallery (minus the code for the table):

![Candi Prambanan|320x180][1]
![San Agustin|166x180][2]
![Moaï|288x180][3]
![Bayon temple|271x180][4]
![San Agustin 2|240x180][5]

[1]: upload://wfnzm0tBLXg6BRQWnIoNfnl8HNs.jpg
[2]: upload://6troRQuaAULLkslCZau5E7mgGPj.jpg
[3]: upload://c0X0waqMVcw3W989DqQrvfZQKHe.jpg
[4]: upload://icDRdwwiwP7yGzIQNRNG9R8pLTN.jpg
[5]: upload://qhIjHkRcsr6o2eJrJtZg4TnDddv.jpg

(Jeff Atwood) #2

Yes, this is 100% by design. If you wish different behavior, change your site settings around images and minimum thumbnail size.


#4

do you mean you can decrease the mimimum size for thumbnail generation as an admin ?


(Régis Hanol) #5

Yup, that’s what “max image width” and “max image height” are for :wink:


#6

ok but then how about the solution I proposed instead ? What do you guys think of it ?


(Michael Brown) #7

we don’t have a minimum thumbnail size… only maximum image size- fiddling with it also means you would end up with tiny images in the post just to get thumbnails generated:

https://try.discourse.org/t/thumbnail-gallery-slideshow-test/1079/4?u=michael

image

(also, seems disabling create thumbnails didn’t change the behaviour)

I do like this idea - this has bothered me on occasion.


#8

I know there’s no minimum thumbnail size, that’s not what I’m referring to.
I’m referring to the minimum image size for Discourse to generate a thumblnail.


(Michael Brown) #9

By default:

  • max image width (Maximum thumbnail width of images in a post): 690
  • max image height (Maximum thumbnail height of images in a post): 500

(should that actually read “Minimum thumbnail width/height of images in a post”?)


#10

oh ok I get what you mean. We were talking about the same thing, just not in the same way.
I don’t know which is the official way to call it.


(Mittineague) #11

lol, I would probably name them “threshold height” and “threshold width” but that would likely be even more confusing to more people.


#12

I ran into a problem thumbnails as well. How exactly are they calculated?
I found that very tall images are clipped in thumbnails.

this is an original image:

this is its thumbnail:
ba703898d630cd0aa25165ee749eedf808e022f8_1_163x500


#13

That’s a good question in fact.
Up to a certain aspect ratio, the automated thumbnail generator doesn’t crop the thumbnail. But when the height is far superior than the width (and not vice versa btw), the generator crops it.
I don’t know where the boundary is.

The problem is that even if you manually change the thumbnail dimensions in the markdown code to give the adequate ratio for a non-cropped thumbnail (still staying below the max values), the generator overrides what you wrote and crops the image anyway.

That seems undesirable to me.

Here’s an example :

raw text :

![Spaceship_small|99x499](upload://usCnxEU5RP1YfNiKw5MPXSCXzMu.png)

generated result (177x500) :


#14

So @codinghorror and @zogstrip, what do you think of this idea ?


(Jeff Atwood) #15

It’s not on any of our roadmaps at the moment


#16

So I guess this means “Sure, why not ? But we have lots to do and this is low priority for us” or am I misinterpreting ?


#17

Yes, the images in Discourse can be really unpredictable. I spent several hours today trying to figure out why some images couldn’t be scaled by editing the Markdown, and others were getting cropped. It was a mess.

Not light-boxing all images is a major inconvenience. If a group of images is around the thumbnail limits, some of them will be light-boxed, some not. If you try to reduce the limits to catch everything, you’ll end up with all thumbnails very small.
Also, I don’t think thumbnails should ever be cropped. A setting perhaps.


#18

I would disagree on the last point. Cropping can be very useful (but should be controllable). Say you want to make a clean squared thumbnail gallery from images of various aspect ratios. You can enter square thumbnail dimensions and instead of distorting the images, it will crop them, making them square yet visually readable.
Aside from that, I think this conversation is a different topic and should be split into a new thread.


(Mittineague) #19

Yes, if something doesn’t fit the options are cropping, resizing, and distorting. Distortion beyond maybe a pixel or three is not an acceptable option. For some images, cropping is the better choice, for others it will be resizing. It is always a best compromise, there is no “always best”.

Anyway, to get back on topic (?) - lightboxing every image - AFAIK, lightboxing generates multiple differently sized copies of an image. So if this ever becomes a thing I think it should be an option as I don’t believe every site would want to increase storage requirements for this.


#20

why would lightboxing generate multiple image sizes ?
If I right-click on a lightboxed image and show its infomations, it shows the original dimensions.


(Mittineague) #21

I’m not sure all environments are set up the same way, but my localhost install has an image in

var/discourse/shared/standalone/uploads/default/original/1x

that is 413 px wide 774 px high and 537K

and a cropped “copy” of the same image in

var/discourse/shared/standalone/uploads/default/optimized/1x

that is 690 px wide 500 px high 159K

Why? I think it’s a courtesy to users to not force the additional 378K bandwidth on them unless they are explicitly interested in the image enough to want the original.

True, for a single image 378K may not be all that much, but with multiple images that extra bandwidth could add up fast.