bic-ed / zenphoto

The Zenphoto open-source gallery and CMS project
www.zenphoto.org
Other
0 stars 0 forks source link

Handle loading lazy attribute from printDefaultSizedImage #8

Open bic-ed opened 1 year ago

bic-ed commented 1 year ago

Do we really need lazy load for the main image in image.php? It apparently causes a performance downgrade. Perhaps we should either remove it or at least use a parameter to allow themes to skip the attribute. Something like: printDefaultSizedImage($alt, $class = null, $id = null, $title = null, $image = null, $loading = 'lazy')

Below the screenshots from two GTmetrics report, with and without the loading lazy attribute:

Loading lazy

Summary Lazy

No loading attribute

Summary

acrylian commented 1 week ago

You got some old tickets here. Yes, the first main image probably does not need lazyloading as this still applies. Sadly just based on the image function itself we do not really know if this is such a main or first image. All image "print" functions would all need an additional parameter to disable lazyloading on request.

bic-ed commented 1 week ago

Yes, these old tickets were here as reminders, I planned to discuss with the team before I had to abandon everything for a long while. I didn't even had memory of them. :-) About this in particular, I guess the lazyload can be removed at least from the printDefaultSizedImage() function, which is mainly used for the main image of image.php

acrylian commented 1 week ago

Probably most themes do use that as the main image. But you cannot be sure what custom stuff anyone really does… And technically this also applies not only to the first main but also first images on a thumb list for example. I think a parameter is the most flexible. I will think about that.

acrylian commented 1 week ago

Btw, Google Pagespeed is the better tool probably nowadays being even mobile first. Although all notes should be take as suggestions and not every noted possible problem is really a problem. Same applies to those Core Web VItals.

bic-ed commented 1 week ago

I think a parameter is the most flexible. I will think about that.

I agree.