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

Reference: https://www.drupal.org/core/beta-changes
Issue category Bug because it doesn't work
Issue priority Normal
Unfrozen changes Unfrozen because it only changes markup
CommentFileSizeAuthor
#1 height_and_width_is_not-2492143-1.patch549 bytesgoogletorp
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

googletorp’s picture

Status: Active » Needs review
FileSize
549 bytes
googletorp’s picture

Issue tags: +Quickfix, +Novice
googletorp’s picture

Issue summary: View changes
googletorp’s picture

Issue summary: View changes

Added beta evaluation.

ieguskiza’s picture

Assigned: Unassigned » ieguskiza
Issue tags: +DUGBE0609
ieguskiza’s picture

Trying 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?

ieguskiza’s picture

Assigned: ieguskiza » Unassigned

Nevermind 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.

googletorp’s picture

Status: Needs review » Reviewed & tested by the community

Updated status based on comment on #9.

webchick’s picture

Status: Reviewed & tested by the community » Fixed

Committed and pushed to 8.0.x. Thanks!

  • webchick committed 83e7458 on 8.0.x
    Issue #2492143 by googletorp, imanol.eguskiza: Height and width is not...

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.