Avatar

Lazy loading for images in entries? (Features)

by Auge ⌂, Wednesday, May 18, 2022, 13:58 (708 days ago)

Hello

Every when and then I try to sweep my browser bookmarks. So I came across an article about lazy loading, a technique to defer the loading of website content to the moment it is actually needed. For My Little Forum the loading of images in entries comes into my mind. Here, in the project forum, it is no issue at all. But it is possible, that having images in entries is a serious issue in other instances.

Beside several JS libraries native browser support is available for most of the browsers. We would only need to add the attribute `loading="lazy"` to some or all of the image elements that gets created in the function do_bbcode_img.

Any thoughts, pros or cons?

Tschö, Auge

--
Trenne niemals Müll, denn er hat nur eine Silbe!

Tags:
lazy loading, images, performance, traffic

Avatar

Lazy loading for images in entries?

by Alfie ⌂, Vienna, Austria, Friday, May 20, 2022, 15:45 (706 days ago) @ Auge

Hi Auge,

[…] I came across an article about lazy loading, a technique to defer the loading of website content to the moment it is actually needed. […] Here, in the project forum, it is no issue at all. But it is possible, that the use of images is a serious issue in other instances.

[…] native browser support is available for most of the browsers. We would only need to add the attribute `loading="lazy"` to some or all of the image elements that gets created in the function do_bbcode_img.

Yep.

Any thoughts, pros or cons?

I don’t use it my forum but in my private photography site for a while. To lazy [pun!] too search but there was a discussion back in the day on the SELFHTML Forum. If you use it without a height- and possibly a width-attribute, it is not clear how ‘large’ the page actually will be. Normally you can estimate that from the scrollbar(s). Hence, having it is fine but at least with height=foo.

--
Cheers,
Alfie (Helmut Schütz)
BEBA-Forum (v1.8β)

Avatar

Lazy loading for images in entries?

by Auge ⌂, Friday, May 20, 2022, 16:02 (706 days ago) @ Alfie

Hello Alfie

Nice to read from you. :-)

[…] I came across an article about lazy loading

Any thoughts, pros or cons?


I don’t use it my forum …

Jes, this is more for the hypothetical case of a forum with photography as its topic.

… but in my private photography site for a while. To lazy [pun!] too search but there was a discussion back in the day on the SELFHTML Forum. If you use it without a height- and possibly a width-attribute, it is not clear how ‘large’ the page actually will be. Normally you can estimate that from the scrollbar(s). Hence, having it is fine but at least with height=foo.

The function do_bbcode_img reads the dimensions of the images and put these information into the img-tag (attributes height and width). So a flickering page because of the changing sizes of the images placeholder shouldn't be an issue.

Tschö, Auge

--
Trenne niemals Müll, denn er hat nur eine Silbe!

Avatar

Lazy loading for images in entries?

by Alfie ⌂, Vienna, Austria, Friday, May 20, 2022, 16:13 (706 days ago) @ Auge

Hi Auge,

The function do_bbcode_img reads the dimensions of the images and put these information into the img-tag (attributes height and width).

Shyte! Not in my installation. Have to change it…

So a flickering page because of the changing sizes of the images placeholder shouldn't be an issue.

Sure.

--
Cheers,
Alfie (Helmut Schütz)
BEBA-Forum (v1.8β)

RSS Feed of thread