Onebox images in email notifications are HUGE

css

(Dan Dascalescu) #1

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


(Régis Hanol) #2

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

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


(Jeff Atwood) #3

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…


(Kane York) #4

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

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

(Jeff Atwood) #5

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.


(Régis Hanol) #6

Just pushed a proper fix :cherries:

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


Onebox-embedded thumbnails don't get resized sometimes for emails
(Régis Hanol) #7