My-Little-Forum / mylittleforum

A simple PHP and MySQL based internet forum that displays the messages in classical threaded view (tree structure)
GNU General Public License v3.0
124 stars 48 forks source link

Native HTML-based lazy loading for images in entries #666

Closed auge8472 closed 1 year ago

auge8472 commented 1 year ago

Loading images in entries the lazy way is a way to enhance the handling of the net traffic by loading images only if they are in or in the near of the browser viewport. The enhancement will only be remarkable in forums with many entries which include many images. With inserting the attribute loading="lazy" to all images in entries, the additional code snippet is a small price to pay in terms of network performance. The browser support is wide (begun approximately around 2020). Older browsers will simply ignore the attribute. So there should be no risk to break something.

See also the discussion in the project forum.

Changes have to be made in the lines 579 and ff. of the script includes/functions.inc.php.