It's impossible to serve responsive images via an API

Created on 6 October 2017, over 7 years ago
Updated 18 September 2023, over 1 year ago

Problem/Motivation

We've stumbled upon this issue when working on exposing responsive images in the graphql module. Src attributes of the img tags output by image styles are (and should be) absolute

* @return string
*   The absolute URL where a style image can be downloaded, suitable for use
*   in an img tag. Requesting the URL will cause the image to be created.

Source: https://github.com/drupal/drupal/blob/8.4.x/core/modules/image/src/Image...

However, the responsive image module strips out the protocol and domain part and uses just the relative parts making it impossible to embed an image in an external site (including a decoupled frontend).

Proposed resolution

Make the responsive image return absolute urls.

User interface changes

None

API changes

None

Data model changes

None

🐛 Bug report
Status

Needs work

Version

11.0 🔥

Component
Responsive image 

Last updated 2 days ago

Created by

🇵🇱Poland blazey

Live updates comments and jobs are added and updated live.
  • Needs subsystem maintainer review

    It is used to alert the maintainer(s) of a particular core subsystem that an issue significantly impacts their subsystem, and their signoff is needed (see the governance policy draft for more information). Also, if you use this tag, make sure the issue component is set to the correct subsystem. If an issue significantly impacts more than one subsystem, use needs framework manager review instead.

  • Needs tests

    The change is currently missing an automated test that fails when run with the original code, and succeeds when the bug has been fixed.

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