The discussion revolves around the inability to perform arbitrary nonproportional image resizing in Discourse, unlike in the previous Flarum platform. connrrr notes that HTML-based image size adjustments result in cropping due to lightbox CSS. Canapin explains that small images retain their aspect ratio, but larger ones are cropped. They suggest workarounds, such as using the avatar class to force dimensions (though it adds a border-radius), or creating a custom wrap with CSS to override object-fit. A CSS rule targeting [data-wrap="ratio"] .lightbox-wrapper img can prevent cropping. The issue highlights the lack of a straightforward user-level solution, with admin-level CSS customization being the most reliable method. Canapin also speculates that a simpler user-level method might exist but is currently unknown.
When our forum was previously on Flarum, a fun thing to do was add size tags to modify the height and width of an image to stretch and squash it, like so (might be misremembering how the tag went)
I’ve tried using HTML equivalents on uploaded images with Discourse, but all this does is crop the image.
I don’t see that there’s any way to do this with uploaded images in Discourse. Am I mistaken?
I wouldn’t be surprised if there was a way to force the aspect ratio as a user, though, or even an easier way as an admin. Maybe don’t even use a wrap and force unset on object-fit in a lightbox div, but that might mess up the regular layout. I don’t know.