Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions .github/changelog/fix/3529-avatar-email-max-width
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
Significance: patch
Type: fixed

Fixed oversized images in email notifications from remote users. Avatars and inline post images now resize to fit the email width instead of overflowing the screen.
2 changes: 1 addition & 1 deletion templates/emails/new-follower.php
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@

<div class="card-body">
<?php if ( ! empty( $args['icon']['url'] ) ) : ?>
<img src="<?php echo esc_url( $args['icon']['url'] ); ?>" alt="<?php echo esc_attr( $args['name'] ); ?>">
<img src="<?php echo esc_url( $args['icon']['url'] ); ?>" alt="<?php echo esc_attr( $args['name'] ); ?>" width="64" height="64">
<?php endif; ?>
<div class="card-content">
<h2><?php echo esc_html( $args['name'] ); ?> <small style="font-size: 14px; color: #666;"><?php echo esc_html( $args['webfinger'] ); ?></small></h2>
Expand Down
4 changes: 4 additions & 0 deletions templates/emails/parts/header.php
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,10 @@
margin: 0 !important;
}
}
img {
max-width: 100%;
height: auto;
}
h1 {
font-size: 20px;
margin-bottom: 16px;
Expand Down
4 changes: 2 additions & 2 deletions templates/embed.php
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
<div class="activitypub-embed u-in-reply-to h-cite">
<div class="activitypub-embed-header p-author h-card">
<?php if ( $args['avatar_url'] ) : ?>
<img class="u-photo" src="<?php echo \esc_url( $args['avatar_url'] ); ?>" alt="" />
<img class="u-photo" src="<?php echo \esc_url( $args['avatar_url'] ); ?>" alt="" width="48" height="48" style="max-width:48px; border-radius:50%;" />
<?php endif; ?>
<div class="activitypub-embed-header-text">
<h2 class="p-name"><?php echo \esc_html( $args['author_name'] ); ?></h2>
Expand All @@ -53,7 +53,7 @@
<?php if ( $args['images'] ) : ?>
<div class="ap-preview <?php echo \esc_attr( 'layout-' . count( $args['images'] ) ); ?>">
<?php foreach ( $args['images'] as $image ) : ?>
<img class="u-photo u-featured" src="<?php echo \esc_url( $image['url'] ); ?>" alt="<?php echo \esc_attr( $image['name'] ?? '' ); ?>" />
<img class="u-photo u-featured" src="<?php echo \esc_url( $image['url'] ); ?>" alt="<?php echo \esc_attr( $image['name'] ?? '' ); ?>" width="600" height="338" style="max-width:100%;" />
<?php endforeach; ?>
</div>
<?php elseif ( $args['video'] ) : ?>
Expand Down