Skip to main content
drupalreleases

Use direct release data with your AI assistant.

Learn more

GraphQL Responsive Image

Security covered Under active development 58 sites

Part of the Graphql ecosystem · 39 projects

This module allows you to output responsive Drupal images via GraphQL. It provides field types that can return either structured image data or the complete HTML markup for a responsive image, with the image style selectable in your GraphQL query.

Overview

GraphQL Responsive Image is an extension of the GraphQL module drupal/graphql 3.0 which adds the possibility to render responsive drupal images using GraphQL.
This module provides a field plugin ResponsiveImage which contains the HTML markup of a rendered responsive image and a field plugin ResponsiveImageStructured that provides a structured response of image and srcsets. The responsive image style can be defined as an option in the GraphQL Query.

Usage

Expand your Media Image in your GraphQL query with the field ResponsiveImage or ResponsiveImageStructured, under style select the desired responsive image style.

query ($node: String!) {
  nodeById(id: $node) {
    ... on NodeContentPage {
      fieldHero {
        entity {
          ... on MediaImage {
            fieldMediaImage {
              ResponsiveImageStructured(style: IMAGESTYLE)
              ResponsiveImage(style: IMAGESTYLE)
            }
          }
        }
      }
    }
  }
}

ResponsiveImageStructured(style: IMAGESTYLE)

Gives you the Responsive Image as structured data back.

Usage (dumping the response object):
{{ dump(graphql.nodeById.fieldYOURIMAGEFIELD.entity.fieldMediaImage.ResponsiveImageStructured) }}.

ResponsiveImage(style: IMAGESTYLE)

Gives you the rendered entity of the Responsive Image back.
If you are using Twig, you can render the responsive image like this

Usage:
{{ graphql.nodeById.fieldYOURIMAGEFIELD.entity.fieldMediaImage.ResponsiveImage | raw }}
Note: This renders the repsonsive image with the according Responsive Image Drupal Template. It will use the Template from the theme if you override the template in your frontend theme.

Drupal 8–11

Ask your assistant about GraphQL Responsive Image

Check compatibility with your Drupal and PHP version, maintenance and security coverage, from current release data. How it works

Depends on

Dependencies of the latest stable release

Required by

Tracked projects that depend on this one

No tracked projects depend on this one yet.

Activity

Tracked releases
3
Tracked since
Jun 2024
Latest release
9 months ago
Releases (12 mo)
1
Maintenance
Active

Release Timeline

Releases

Version Type Core PHP Release date
8.x-1.6 Stable 8–11 Jan 9, 2026
8.x-1.5 Stable 8–11 Jul 23, 2025
8.x-1.4 Stable 8–10 Jun 25, 2024