Onebox images in email notifications are HUGE

The Onebox for this link looks like this in the notification email:

2 Likes

Just reverted a changed made 1 year ago :astonished: by @codinghorror

https://github.com/discourse/discourse/commit/6c2978168729df6c654665cb527811b220a03079

1 Like

I think the reason I made that change is some images were showing up wider than the email. But it definitely should not have applied to onebox images. I suspect this will cause problems since the case cited above is specific to oneboxes, whereas that CSS change was about the whole email. We’ll see…

Looks like what you’re supposed to do for that is:

width: 100%;
max-width: 75px;

Yeah this has screwed up my email notifications on iPhone with images now look super wide, as they ‘stretch’ to the size of the largest image, like this:

The actual markup is

<img src="image.png" width="auto" height="auto" class="CToWUd">

The line that was incorrectly removed is

add_styles(img, 'max-width:100%;') if img['style'] !~ /max-width/

Since there is no max width, the email will just become super tiny / wide if the embedded image is very wide.

Just pushed a proper fix :cherries:

https://github.com/discourse/discourse/commit/e2121c2c2c8b941d08231078b2e9fb09612785ea

3 Likes

I think there is one more case we have not handled here:

The thumbnail class is not being properly resolved in emails when oneboxing an external Discourse forum.

@techAPJ can you sort this one out?

5 Likes

Fixed via

https://github.com/discourse/discourse/commit/1b2bd3606191da4054c45664abfcc7ffaf9cda7d

6 Likes