Skip to content

A platform for community discussion. Free, open, simple.

FIX: Don't blow up small images in chat (#40737)

Jarek Radosz80dc37144602
diff --git a/plugins/chat/assets/javascripts/discourse/components/chat-upload.gjs b/plugins/chat/assets/javascripts/discourse/components/chat-upload.gjs
index d451986ce0a..e8b720a760c 100644
--- a/plugins/chat/assets/javascripts/discourse/components/chat-upload.gjs
+++ b/plugins/chat/assets/javascripts/discourse/components/chat-upload.gjs
@@ -38,7 +38,9 @@ export default class ChatUpload extends Component {
const width = this.args.upload.width;
const height = this.args.upload.height;
+ // Shrink to fit, never blow up small images.
const ratio = Math.min(
+ 1,
this.siteSettings.max_image_width / width,
this.siteSettings.max_image_height / height
);