Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
Problem/Motivation
In the documentation for the responsive image preprocessor, you can read the following:
/**
* Prepares variables for a responsive image.
*
* Default template: responsive-image.html.twig.
*
* @param $variables
* An associative array containing:
* - uri: The URI of the image.
* - width: The width of the image (if known).
* - height: The height of the image (if known).
* - attributes: Associative array of attributes to be placed in the img tag.
* - responsive_image_style_id: The ID of the responsive image style.
*/
The problem is that height and width is always ignored.
This is also a small performance cost, since the formatter always will provide these, which means these will have to be calculated 2 x the amount of source tags being created.
Proposed resolution
Allow use of height and weight
Remaining tasks
Do it
User interface changes
API changes
Beta phase evaluation
Issue category | Bug because it doesn't work |
---|---|
Issue priority | Normal |
Unfrozen changes | Unfrozen because it only changes markup |
Comment | File | Size | Author |
---|---|---|---|
#1 | height_and_width_is_not-2492143-1.patch | 549 bytes | googletorp |
Comments
Comment #1
googletorp CreditAttribution: googletorp as a volunteer commentedComment #2
googletorp CreditAttribution: googletorp as a volunteer commentedComment #3
googletorp CreditAttribution: googletorp as a volunteer commentedComment #4
googletorp CreditAttribution: googletorp as a volunteer commentedAdded beta evaluation.
Comment #7
ieguskiza CreditAttribution: ieguskiza as a volunteer commentedComment #8
ieguskiza CreditAttribution: ieguskiza as a volunteer commentedTrying to reproduce the issue I have been unable to successfully display an image on a node.
So far adding the image through the ckeditor works, but attached images are never displayed, it doesn't matter which display type I choose (responsive or not).
Anyone else having this problem?
Comment #9
ieguskiza CreditAttribution: ieguskiza as a volunteer commentedNevermind my last comment, issue lied in my Drupal configuration.
I have tested the patch and can confirm that the weight and height variables are available after applying the patch.
Ready to RTBC.
Comment #10
googletorp CreditAttribution: googletorp as a volunteer commentedUpdated status based on comment on #9.
Comment #11
webchickCommitted and pushed to 8.0.x. Thanks!