only auto scale email img if both dims large

This commit is contained in:
Jeff Atwood 2014-11-14 16:23:52 -08:00
parent 11ae3caeff
commit 855305b0f6

View File

@ -38,8 +38,10 @@ module Email
img['height'] = 20
else
# having no extra style on email images might work best?
img['width'] = 'auto' if img['width'].to_i > 250
img['height'] = 'auto' if img['height'].to_i > 250
if img['width'].to_i > 250 and img['height'].to_i > 250
img['width'] = 'auto'
img['height'] = 'auto'
end
add_styles(img, 'max-width:100%;') if img['style'] !~ /max-width/
end