Skip to main content
Drupal is a registered trademark of Dries Buytaert
Release: Views Bootstrap 5.5.4 — Minor update available for module views_bootstrap (5.5.4). Release: Download Tracker 1.0.7 — Minor update available for module download_tracker (1.0.7). Release: Directory2Block Slideshow 1.0.8 — Minor update available for module directory2block_slideshow (1.0.8). Release: Mautic Audiences 1.1.5 — Minor update available for module mautic_audiences (1.1.5). Release: Rightup theme 1.0.3 — Minor update available for theme vartheme_bs5_rightup (1.0.3). Release: CommentOn 1.0.6 — Minor update available for module commenton (1.0.6). Release: ChatGPT Ads 1.0.3 — Minor update available for module chatgpt_ads (1.0.3). Release: Opensolr Search 5.1.3 — Minor update available for module opensolr_search (5.1.3). Module Revived: Swagger-PHP OpenAPI 3 documentation generator 1.0.0 — Module swagger_php updated after 10 months of inactivity (1.0.0). Security Coverage: Microsoft Azure AI — Module ai_provider_azure now has official Drupal security advisory coverage.

Responsive Image Preload

Security covered Drupal 10–11
View on drupal.org

The goal of this module is to provide a mechanism to help improve the Largest Contentful Paint web vital metric.

This module requires careful research, testing, and configuration to be effective!

There are a vast number of variables to consider when attempting to optimize the LCP metric. As such, it is highly recommended to conduct experimentation prior to enabling this module.

  1. Determine if there are eligible images that are also the LCP bottleneck. The investigation scope should encompass every page of the site that is exposed to search engines. Remember, by optimizing one type of page, another may backslide. Always make data-driven decisions when navigating performance problems.

    1. Is "mobile" or "desktop" LCP metric in need of improvement?
    2. Is there an opportunity to improve LCP by improving infrastructure, such as implementing a globally distributed CDN or enabling HTTP/2?
    3. Are there any image optimizations that can be made such as reducing quality or trying out the webp module?
  2. Confirm that the proper breakpoints are configured for the responsive image module. Preload media queries work differently than srcset or <picture> element media queries. Refer to the preload specification for comprehensive details, but the essential difference is that preloads will not automatically choose the most appropriate derivative to load. Rather, all media queries that resolve true will be loaded.
  3. Most importantly, confirm that turning this module on actually reduces the LCP metric! Do not assume that it will without any other configuration tweaks!

How does it work?

This module provides a mechanism that attaches to the core responsive image field formatter plugin that is capable of generating a set of preload links that can cause the proper image derivatives to be downloaded much earlier in the rendering process. It does not otherwise change the behavior of the core formatter plugin.

What can it do?

Sometimes browsers can use a helping hand prioritizing asset downloads. By preloading an asset, it is able to jump to the front of the line. Take the following example:

Before

After

What's the difference?

Before, there was a period of roughly 600 milliseconds where the asset that determines the LCP timing was in limbo waiting for the HTTP/2 socket to become available. There seems to be a much better chance of the asset downloading quicker if it is the first asset to use the socket.

As can be seen in the second image, there is no queueing period anymore.

Installation

Install this module via composer composer require drupal/responsive_image_preload

Configuration

This module provides a third party setting for the core Responsive Image formatter. Configure it on the entity view displays that need to be preloaded. It is highly recommended to check out the configuration guide for more details and recommendations.

Depends on

Dependencies of the latest stable release

  • responsive_image Drupal core

Required by

Tracked projects that depend on this one

No tracked projects depend on this one yet.

Activity

Tracked releases
2
Tracked since
Mar 2023
Latest release
2 years ago
Releases (12 mo)
0
Maintenance
Active

Releases

Version Type Core Release date
2.0.1 Stable 10–11 Sep 13, 2024
2.0.0 Stable Mar 6, 2023