Skip to content

Commit

Permalink
Use img to load avatars
Browse files Browse the repository at this point in the history
* Stop sending referrer request data to Gravatar (reduces data sharing with Gravatar, improves user privacy).
* Enable lazy loading avatar images (reduces image download request priority, defers downloading off-screen images).
  • Loading branch information
da2x committed Dec 2, 2021
1 parent 3a1e0cf commit f46a920
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 5 deletions.
6 changes: 4 additions & 2 deletions backend/classes/commentsui.php
Original file line number Diff line number Diff line change
Expand Up @@ -259,8 +259,10 @@ public function userAvatar ($src = '{src}', $href = '{href}', $text = '{text}')

if ($this->setup->iconMode !== 'count') {
// Create avatar image element
$comments_avatar = new HTMLTag ('div', array (
'style' => 'background-image: url(\'' . $src . '\');'
$comments_avatar = new HTMLTag ('img', array (
'src' => $src,
'referrerpolicy' => 'no-referrer',
'loading' => 'lazy'
), false);
} else {
// Avatars set to count
Expand Down
5 changes: 3 additions & 2 deletions backend/classes/formui.php
Original file line number Diff line number Diff line change
Expand Up @@ -257,8 +257,9 @@ protected function avatar ($text)
}

// Create avatar image element
$avatar = new HTMLTag ('div', array (
'style' => 'background-image: url(\'' . $avatar_src . '\');'
$avatar = new HTMLTag ('img', array (
'src' => $avatar_src,
'referrerpolicy' => 'no-referrer'
), false);
} else {
// Avatars set to count
Expand Down
2 changes: 1 addition & 1 deletion themes/default/email-notification.html
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@
<body>
<div id="main">
<div id="header">
<img id="avatar" src="{avatar}" width="128" height="128" alt="avatar">
<img id="avatar" src="{avatar}" width="128" height="128" alt="" referrerpolicy="no-referrer">
<p id="name">{name}</p>
<p>{domain}</p>
</div>
Expand Down

0 comments on commit f46a920

Please sign in to comment.