Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature Proposal: LazyLoad Images across all PageBuilder Content Types #68

Open
gil-- opened this issue May 24, 2018 · 2 comments
Open
Labels

Comments

@gil--
Copy link
Member

gil-- commented May 24, 2018

I'd like to propose adding lazyloading to images in Page builder. This is a feature I would be willing to add and make a PR for but I'd like to confirm if it would be acceptable to the Page Builder core team.

Proposal Draft

Background

Several of our clients whom are currently using BlueFoot have pages with many images that could cause the page size to be >5mb in size. As a result we implemented lazyloading of images with progressive enhancement (intrinsic sizing + blur-up) to speed up initial page load speed and avoid shifting of content (images loads then page content shift down, etc.).

Feature Proposal

I'd like to propose adding lazyloading to all block images so that they only load when the user has the image in view. We use lazysizes. You set the image to data-src="" and with JS it then sets the image to src="" when it scrolls into view (or will scroll into view in X).

Intrinsic Sizing

Intrinsic is used so that the image still takes up the same space in the DOM until it loads. You can then set an inline transparent gif as the src to create intrinsic loading. Magento2 currently does something similar for the catalog page where the image is absolute positioned

Blur-Up

Blur-up is another technique we've used where we dynamically create a new image crop of ~40px in width and set it to 100% of the image container width. You can blur it into the full-size image. See example:

Implementation Details

This would require:

  • adding lazysizes to page-builder as a JS vendor file
  • adding the Less for hiding the image display: none until lazyload has loaded the image
  • adding intrinsic and blur-up Less styling
  • adding intrinsic and blur-up as optional selections (checkbox/dropdown) in the admin. there are use-cases where you do not want intrinsic sizing.

Example

You can see a live example on RileyHome which uses BlueFoot with LazySizes and images only load when they come into view. There's a background-color used as a placeholder until the image fully loads.

This is a rough draft of the proposal and I can flesh it out with more actual examples of code and implementation if you think it's something that would be accepted.

@melnikovi
Copy link
Member

Thank you for your proposal @gil--. We are working on design that would allow to add unlimited number of images. After we finish it, I will share it with you to see how can we cooperate. Thank you again.

@omiroshnichenko
Copy link
Contributor

Hi @gil--. Your proposal sounds great. If you are still interested in the contribution, please, let us know and we could discuss it in more detail. Thanks for your contribution.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants