postimage lazy loading

Do not post support requests, bug reports or feature requests. Discuss phpBB here. Non-phpBB related discussion goes in General Discussion!
Ideas Centre
Post Reply
oferlaor
Registered User
Posts: 1
Joined: Sat Dec 04, 2004 6:31 am

postimage lazy loading

Post by oferlaor »

I edited the template (a custom version of prosilver) and added in attachment.html loading="lazy"

That really improves performance - but has an annoying side effect. when you scroll down (e.g., to #unread), it takes a while for the images to catch up, causing the scroll position to shift.
User avatar
EA117
Registered User
Posts: 2068
Joined: Wed Aug 15, 2018 3:23 am
Contact:

Re: postimage lazy loading

Post by EA117 »

Indeed, the browser would have to know the size of the image that isn't being displayed yet, in order to know how much real estate to reserve within the page.

Maybe someone knows of the smarter or more modern method, but so far as I know, you would have to change phpBB to use image horizontal and vertical size data of each image attachment to render the <img> tags with a specific height= and width= attribute, in addition to the lazy load processing. Such that even when the <img> tags are still "blank", they already require the same amount of horizontal and vertical room the displayed image will also eventually require.

That seems like it would require an extension on both points: Making best effort to determine accurate image dimensions for the thumbnail or attachment to be displayed, and then modifying the rendered <img> tags to include the specific height= and width= attributes.
Post Reply

Return to “phpBB Discussion”