Yes, Discourse has assumptions to how it should work, but I feel there may be better ways to handle it. I could at the very least, strip out their implementation and put in my own, and/or enhance their implementation to be more responsive and fit the screen better.
Ideally the image should take up most of the available width (within the max width of the page already set) and have a set max height (to avoid super long images dominating the page). It should be at good enough quality to be readable and obviously on click you should be able to see the full size image. If the image is smaller than the size of the width, it should be as big as it is.