Enable lazy loading for embedded media
authorAlexander Ebert <ebert@woltlab.com>
Sun, 16 Jan 2022 14:11:09 +0000 (15:11 +0100)
committerAlexander Ebert <ebert@woltlab.com>
Sun, 16 Jan 2022 14:11:09 +0000 (15:11 +0100)
wcfsetup/install/files/lib/data/media/ViewableMedia.class.php

index cefe837077ba265fbf3b2ca08fe83f5b6ae60fa8..40bb353fd17fb9866415086b1cb6dbae8092abad 100644 (file)
@@ -186,7 +186,7 @@ class ViewableMedia extends DatabaseObjectDecorator
                 return '<span style="display: inline-block; text-align: center; width: ' . $size . 'px; height: ' . $size . 'px;">
                             <img src="' . StringUtil::encodeHTML($link) . '" alt="' . StringUtil::encodeHTML($this->altText)
                     . '" ' . ($this->title ? 'title="' . StringUtil::encodeHTML($this->title) . '" ' : '')
-                    . 'style="width: ' . $width . 'px; height: ' . $height . 'px; margin-top: ' . $marginTop . 'px;">
+                    . 'style="margin-top: ' . $marginTop . 'px;" height="' . $height . '" width="' . $width . '" loading="lazy">
                         </span>';
             }
         }