Thumbnails get trimmed and subsequently squished

(Felix R.) #1

I’ve set up Discourse using the recommended Docker setup. However, I’m having trouble with images. The forum is going to be used for illustrations and graphics often, and we ran into some problems with images that have transparent margins. It seems the margins get cut off, and the image gets resized (via height/width attributes) according to what the aspect ratio was before the crop.
I’ve attached two images. One is a screenshot of how it looks, the second one is the original image. Interestingly enough, if I remove the height="500" and width="500" attributes from the <img> tag, the image is not squished anymore, but still has the borders cut off, which I don’t want. Is there a setting somewhere for that behaviour or is it something ImageMagick does on its own?

edit: I see that on this installation, the borders don’t get cut off. Any explanation as to why?

(Jeff Atwood) #2

Are you on the latest version? Any weird site settings changed with regards to images?

(Felix R.) #3

I’m on version 1.2.0.beta4. The only settings I’ve changed are the maximum image file size and enabling animated thumbnails. I’ve already tried reverting those settings to their default values, to no avail.

edit: Actually, it seems it is related to the animated thumbnails setting. After turning it off, any newly uploaded pngs with transparency seem to be okay.
This also fixed another issue we were experiencing, where .png files with semi-transparent areas were not thumbnailed properly, getting artifacts and blotches of colour.
Would making sure the animated thumbnail setting is only applied to .gif files be a good idea? I would look into submitting a pull request then.

(Jeff Atwood) #4

Yes please! Sorry about that and cc: @zogstrip the animated handling should only kick in for .gif in the code oath.

(Régis Hanol) #5

It’s now fixed :water_buffalo:

(Régis Hanol) #6