Skip to main content
Drupal is a registered trademark of Dries Buytaert
Release: OpenID Connect / OAuth client 3.0.0-alpha9 New alpha version released for module openid_connect (3.0.0-alpha9). Usage Milestone: Google Analytics Module google_analytics crossed 1,000 active installs. Release: Timelinr 1.0.1 Minor update available for module timelinr (1.0.1). Release: GraphQL Compose Codegen 1.1.2 Minor update available for module graphql_compose_codegen (1.1.2). Release: Mapy.com 1.1.3 Minor update available for module mapycom (1.1.3). Release: Ckeditor5 entity browser 3.0.3 Minor update available for module ckeditor5_entity_browser (3.0.3). Release: Ckeditor5 entity browser 3.0.1 Minor update available for module ckeditor5_entity_browser (3.0.1). Release: Ckeditor5 entity browser 3.0.2 Minor update available for module ckeditor5_entity_browser (3.0.2). Release: Teamleader Integration 4.0.2 Minor update available for module teamleader (4.0.2). Module Revived: Entityqueue Buttons 1.1.2 Module entityqueue_buttons updated after 8 months of inactivity (1.1.2).

This module provides an image field formatter that allows you to select different image sizes based on the user's screen width. It ensures users download the most appropriately sized image, serving smaller images to mobile devices and higher quality images to larger screens, without requiring server configuration or external libraries.

The Client-side adaptive image module helps build responsive web designs with fluid images by providing an Image field formatter that allows you to select appropriate image styles for various client widths. With this module, you can ensure that for each Image field only the most appropriately sized image gets downloaded by the client.

You can serve light images to mobile users while still providing the best quality images to visitors equipped with large screens.

Some highlights:

  • Per-field configuration (for each view mode).
  • Relies on JavaScript but provides a clean fallback for clients lacking it.
  • No cookies required.
  • No external libraries required.
  • No extra server configuration needed.
  • Does not attempt to perform any client OS detection.
  • Reverse proxy cache friendly.

How it works

Image selection rests solely on the client's side, hence the name of the module. Unlike some other adaptive image techniques, the server takes no part in the image selection process. Instead, the module provides the list of candidate images during page generation, and the client picks the right one through JavaScript (or through a fallback if JavaScript is not enabled).

The technique used by this module was inspired by Mairead Buchan's article Creating responsive images using the noscript tag and her finding that children of the <noscript> tag are rightfully not added to the DOM when JavaScript is enabled.

What the module does is basically this:

  • Wrap a fallback image in a <noscript> element.
  • Attach references to alternate images to the <noscript> element using data attributes. Data attributes are an HTML5 feature but work in older browsers as well.
  • Using JavaScript, retrieve the client's width, pick the right image from the data attributes, and insert it in the document after the <noscript> element. Note that we're referring to the client's width rather than the document's width or the window's width. That's because the width is retrieved using the document.documentElement.clientWidth property, which behaves inconsistently across browsers.
  • Watch for window resize events, and replace the images when appropriate.

Similar projects

You might be interested in the following Drupal modules, which provide similar functionality using different techniques and/or architectures:

Credits

This project has been sponsored by: Whisky Echo Bravo

Depends on

Dependencies of the latest stable release

No dependencies recorded for this project.

Required by

Tracked projects that depend on this one

No tracked projects depend on this one yet.

Activity

Tracked releases
2
Tracked since
Sep 2025
Latest release
11 months ago
Releases (12 mo)
2 ▲ from 0
Maintenance
Slowing

Releases

Version Type Core Release date
2.0.x-dev Dev 8–9 Sep 20, 2025
7.x-1.2 Stable Sep 20, 2025