Fix: constrain image sizes in email notifications - #3637
Open
faisalahammad wants to merge 1 commit into
Open
Conversation
Constrain avatar and post images in email notifications so large remote avatars no longer render at native size and overflow the screen. Email clients often strip inline styles, so the size is now enforced with width/height attributes on the embed avatar, the new follower icon, and a global max-width rule in the shared email header style block. Fixes Automattic#3529
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #3529
Proposed changes:
img { max-width: 100%; height: auto; }rule to the shared email header style block so every image in every email template fits the email width.width/heightattributes to the embed avatar (48px) and the new follower icon (64px) so the size holds even when styles are dropped. These match the sizes the existing CSS already enforces, so the public embed output is unchanged.Other information:
Logged-in test of email templates can't be automated here, so the fix was verified against the repository CSS and template output. The changes are template and CSS-only with no logic change, so no PHPUnit coverage is added.
Testing instructions:
npm run env-start).<style>blocks (for example Gmail).Changelog entry
A changelog entry was added manually as
.github/changelog/fix/3529-avatar-email-max-width.Changelog Entry Details
Significance
Type
Message
Fixed oversized avatar and post images in email notifications from remote users. Avatars and inline images now resize to fit the email width instead of overflowing the screen.