Responsive Image styles

Created on 18 July 2024, 5 months ago

Problem/Motivation

GraphQL Compose returns Image Styles using variations based on each style.
With Responsive Image styles, these could return rendered styles, similar to graphql_responsive_image.

Steps to reproduce

Enable responsive_image. Query Responsive Image attributes.

Proposed resolution

Add computed attributes similar to variations, but for Responsive Styles (like narrow, wide).

ResponsiveImage (style: wide)
ResponsiveImageStructured(style: wide)

This could return structured and rendered outputs:

"ResponsiveImage": "  <img srcset=\"/sites/default/files/styles/max_325x325/public/2023-09/Hero%20Carousel.png?itok=qegoFqsi 325w, /sites/default/files/styles/max_650x650/public/2023-09/Hero%20Carousel.png?itok=Avde_2jI 650w, /sites/default/files/styles/max_1300x1300/public/2023-09/Hero%20Carousel.png?itok=a7MXZLv_ 1300w, /sites/default/files/styles/max_2600x2600/public/2023-09/Hero%20Carousel.png?itok=D6PcosLJ 1512w\" sizes=\"(min-width: 1290px) 1290px, (min-width: 900px) 650px, (max-width: 559px) 325px, 100vw\" width=\"650\" height=\"361\" src=\"/sites/default/files/styles/max_325x325/public/2023-09/Hero%20Carousel.png?itok=qegoFqsi\" alt=\"Lady with Dog\" />\n\n"

"ResponsiveImageStructured": {
                  "image": {
                    "url": "/sites/default/files/styles/max_325x325/public/2023-09/Hero%20Carousel.png",
                    "alt": "Lady with Dog",
                    "title": "",
                    "width": 325,
                    "height": 181
                  },
                  "sources": [
                    {
                      "srcset": "/sites/default/files/styles/max_325x325/public/2023-09/Hero%20Carousel.png?itok=qegoFqsi 325w, /sites/default/files/styles/max_650x650/public/2023-09/Hero%20Carousel.png?itok=Avde_2jI 650w, /sites/default/files/styles/max_1300x1300/public/2023-09/Hero%20Carousel.png?itok=a7MXZLv_ 1300w, /sites/default/files/styles/max_2600x2600/public/2023-09/Hero%20Carousel.png?itok=D6PcosLJ 1512w",
                      "media": "",
                      "type": "image/png"
                    }
                  ]
                }
✨ Feature request
Status

Active

Version

2.2

Component

Code

Created by

πŸ‡ΊπŸ‡ΈUnited States spfoos

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

Production build 0.71.5 2024