Onebox images in email notifications are HUGE

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


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

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:


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?


Fixed via