At Vardot, handling responsive images effectively has been one of the main challenges we faced when building Drupal websites using Varbase. Traditional methods like CSS, image styles, or even the modern Responsive Image modules often involve time-consuming, repetitive tasks, and a lot of manual adjustments to configure the responsiveness of images across the whole website.
We built large-scale websites that had over 30 responsive image styles, this wasn’t scalable and often became hard to maintain. Our new module Dynamic Responsive Image - Improved, integrated in Varbase now offers a whole new approach that generates image sizes on the fly based on pre-defined aspect ratio. This module simplifies responsive image management, reduces server load, improves page load time, enhances SEO and accessibility, and makes working with images much more fun.
Traditional methods of handling responsive images in Drupal, using classic image styles and the Responsive Image module, have become very time-consuming and tedious. In each project, we spend numerous hours configuring image styles to cater to all screen resolutions and breakpoints, and ultimately managing a complex network of image configurations across the whole website. This process wasn't only time-consuming, but also error-prone, particularly with large-scale websites where sometimes over 30 image styles are required.
The ‘Dynamic Responsive Image (Drimage) - Improved’ module addresses these challenges and offers a whole new to handle image responsiveness in Drupal more efficiently.
Without relying on Image Styles or Responsive Images, Drimage Improved generates image sizes on the fly based on a viewport size and a pre-defined aspect ratio to maintain proportions across devices and screen sizes offering a consistent visual experience, w.
This module dynamically generates image sizes off an optimized WebP image on screen resize, with this approach we reduced the need for creating and managing numurous number of image styles. And by serving the appropriate size for each device, we drastically minimized page load time improving the overall experience. Last but not least, relying on aspect ratios, we ensured high-quality images without the distortion often caused by traditional methods.
Drimage Improved - now integrated with Varbase - ensures compatibility and ease of use for image handling. When setting up an image field, this module allows you to define the desired aspect ratios to determine the proportion for different display contexts, and when the image is loaded Drimage Improved doesn’t pre-generate multiple sizes and inject the HTML, rather it generates only the necessary image size on the fly based on the aspect ratio or the configuration in the display field. This module will detect the device to determine the optimal size required for the user screen, device resolution, pixel density, and viewport size.
Once the appropriate aspect ratio and size are determined, the module then caches the image to minimize server load for subsequent requests, ensuring maximum performance.
For older browsers or devices that may not support the latest responsive techniques, the module includes a fallback mechanism to ensure that images are displayed correctly without the enhanced optimizations.
Utilizing aspect ratio for image generation and resizing provides numerous advantages, especially when compared to traditional methods. The aspect ratio will maintain the proportional integrity of images preventing distortion and providing a cohesive visual experience essential for user satisfaction.
This helped in drastically reducing load time, data transfer requests to the server, and the overall page speed. The on-the-fly image generation and caching reduced the need for storing multiple pre-generated image sizes in the server leading to a more resource-efficient approach to dealing with images.
This adaptive approach ensured that we maintained high-quality images without stretching or squishing, and the method of optimized delivery had a great impact on SEO ranking as searches prioritize websites that offer quick and efficient user experience. This approach aligns with the modern web standards and best practices ensuring long-term capabilities and performance.
Implementing the ‘Dynamic Responsive Image (Drimage) - Improved’ module in your Drupal project involves several key steps, below is a guide to help you get started.
1. Install
Download and install the module from the Drupal repository, you can use the admin interface or composer to install the module.
composer require 'drupal/drimage_improved
2. Configure
Navigate to the module configuration page at admin/config/media/drimage_improved and set your global settings such as ‘minimum difference per image style”, the maximum allowed ratio distortion, the maximum, and the minimum style image.
Enabling device pixel ratio detection and core WebP support is highly advisable as the ratio detection will make sure higher quality images are produced, while core WebP support will ensure that highly optimized images are served to the client.
We highly advise installing WebP module to generate smaller version of the uploaded image but with much richer details.
3. Manage Display
In the content types manage display tab, choose Dynamic Responsive Image as a format for the intended display. Define settings for handling image rendering, aspect ratio, lazy loading, and link if needed.
By following these implementation steps, we no longer rely on the Responsive Image module, image styles, or managing huge lists of pre-defined displays for each view which was very tricky to maintain and keep track of.
Adopting innovative solution will lead to more efficient workflows. We work daily to make Varbase better, faster, and smarter. Drimage Improved as a our latest addition sets a new standard for responsive image handling in Drupal using modern methodologies and smart efficient technique that saved us hundreds of development hours, —and it can do the same for you.