Europe's Drupal Developer focused event is coming up between 19-22 July 2023 in Vienna! Meet core developers and the minds behind some of the key projects and initiatives!This is a small helper module which will automatically lazyload all images for sites with multiple images, which will make the site load faster.
All images will only load when it's visible to the browser window.
Available Settings:
1) Enable/Disable
2) Distance - image distance from the viewable browser window before the actual image loads
3) Placeholder Image - stand-in image
4) Loader Icon - animating icon (shamelessly borrowed from ajaxblocks module)
5) Excluded Pages - page paths to be excluded from image lazyload
For other images:
You can also manually lazyload your other images not processed by Drupal image module by formatting your img markup to this:
Attributes:
1) src = path to placeholder image
2) data-src = path to actual image
3) width = add width for best result
4) height = add height for best result
5) Add a container block
Example:
<div class="image-container"><img src"/sites/default/files/image_placeholder.gif" data-src="/sites/default/files/actual_image.jpg" alt="Image" /></div>
Note: For best result, use Drupal 7.12 and above. (lower versions of Drupal 7 don't have image width and height attributes which are used by lazyloader for detecting image position and positioning of the wait icon). Due to a hook theme registery alter your cache has to be rebuilt first before the script can be triggered.
Branch 2.x
The 1.x version has some implementation issues which makes solving certain bugs and implementing certain features impossible without a whole lot of work to both the php and javascript codebase. This is why the 2.x branch has been created. The 2.x branch will no longer have a custom lazyloading script, but uses the echo library for lazyloading. This also means a new dependency on the libraries module.
Development
All new development is done against the 2.x branch. Automated testing is added (required) for new features and bugfixes. Simple patches for 1.x are accepted as long as they are not disruptive.
Installation instructions
- Download and install lazyloader and libraries modules in
sites/all/modules/contrib - Download the echo library and place it in sites/all/libraries so that
echo.jsandecho.min.jsare found insites/all/libraries/echo/dist - Enable the module and clear your cache.
Similar Projects
Related Project/s
Sponsors
Promet Source, an Acquia Drupal partner company
Daniel Honrade, original author.
Project information
Minimally maintained
Maintainers monitor issues, but fast responses are not guaranteed.- Module categories: JavaScript Utilities, Media, Mobile, Performance and Scalability, SEO, Theme Enhancements
4,578 sites report using this module
- Created by danielhonrade on , updated
Stable releases for this project are covered by the security advisory policy.
Look for the shield icon below.
Releases
New release with Drupal 9 support
Development version: 8.x-1.x-dev updated 1 Feb 2022 at 20:48 UTC
Development version: 7.x-2.x-dev updated 2 May 2019 at 16:48 UTC
- Testing result: PHP 7 & MySQL 5.5, D7 6 pass, 1 fail all results
Development version: 7.x-1.x-dev updated 7 Sep 2015 at 15:28 UTC
- Testing result: PHP 7 & MySQL 5.5, D7 No tests found all results
















