I use the "image" file display, I embed an image (in media_large view mode) into the body of a node using he media module.
I can then resize dynamically the image which will add some size hints to the media markup.
The generated image_style render array seems ok (we can see the specified size is overriden in 3 different place of the array).

array(10) {
  ["#theme"]=>
  string(11) "image_style"
  ["#style_name"]=>
  string(5) "large"
  ["#path"]=>
  string(21) "public://logo.jpg"
  ["#width"]=>
  int(340)
  ["#height"]=>
  int(300)
  ["#file"]=>
  object(stdClass)#65 (13) {
    ["fid"]=>
    string(4) "1200"
    ["uid"]=>
    string(1) "1"
    ["filename"]=>
    string(12) "logo.jpg"
    ["uri"]=>
    string(21) "public://logo.jpg"
    ["filemime"]=>
    string(10) "image/jpeg"
    ["filesize"]=>
    string(5) "31379"
    ["status"]=>
    string(1) "1"
    ["timestamp"]=>
    string(10) "1329497084"
    ["type"]=>
    string(5) "image"
    ["override"]=>
    array(5) {
      ["attributes"]=>
      array(4) {
        ["alt"]=>
        string(0) ""
        ["class"]=>
        string(11) "media-image"
        ["height"]=>
        string(2) "55"
        ["width"]=>
        string(2) "63"
      }
      ["alt"]=>
      string(0) ""
      ["class"]=>
      string(11) "media-image"
      ["height"]=>
      string(2) "55"
      ["width"]=>
      string(2) "63"
    }
  }
  ["#view_mode"]=>
  string(11) "media_large"
  ["#language"]=>
  string(2) "fr"
  ["#attributes"]=>
  array(4) {
    ["alt"]=>
    string(0) ""
    ["class"]=>
    string(11) "media-image"
    ["height"]=>
    string(2) "55"
    ["width"]=>
    string(2) "63"
  }
  ["#alt"]=>
  string(0) ""
}

But in the HTML markup, width and height are reset to their original values (maybe fetched from #style_name ?), eg <img height="300" width="340" ... />
The user-defined sizes should take precedence.

Maybe related:
#1345744: cropped image has incorrect metadata width and height in imagefield
#1392416: Dimensions not rendered on fields with default image

Comments

drzraf’s picture

(I need to recall myself to retest this now, since 312769b7d7 from #1329586: theme_image_formatter should pass along attributes has been pushed)

drzraf’s picture

No, this did not fix it.

tim.plunkett’s picture

Version: 7.x-dev » 8.x-dev
Status: Active » Postponed (maintainer needs more info)
Issue tags: +Needs backport to D7

Can you still reproduce this error?

drzraf’s picture

Of course I can.
Using media 2.x, the "file styles" display obeys resizing while the "image" display does not.
I would increase the priority of this issue as the "file styles" module is not longer an alternative supported by the media module.

(On the same subject, but a different bug within media : #1411340: Resizing images in WYSIWYG broken in media-7.x-1.0-rc3+ & 2.0-unstable3+)

drzraf’s picture

Status: Postponed (maintainer needs more info) » Active

which additional information maintainer needs ?

drzraf’s picture

ping ?

drzraf’s picture

Issue summary: View changes

original value precision

Version: 8.0.x-dev » 8.1.x-dev

Drupal 8.0.6 was released on April 6 and is the final bugfix release for the Drupal 8.0.x series. Drupal 8.0.x will not receive any further development aside from security fixes. Drupal 8.1.0-rc1 is now available and sites should prepare to update to 8.1.0.

Bug reports should be targeted against the 8.1.x-dev branch from now on, and new development or disruptive changes should be targeted against the 8.2.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

Version: 8.1.x-dev » 8.2.x-dev

Drupal 8.1.9 was released on September 7 and is the final bugfix release for the Drupal 8.1.x series. Drupal 8.1.x will not receive any further development aside from security fixes. Drupal 8.2.0-rc1 is now available and sites should prepare to upgrade to 8.2.0.

Bug reports should be targeted against the 8.2.x-dev branch from now on, and new development or disruptive changes should be targeted against the 8.3.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

Version: 8.2.x-dev » 8.3.x-dev

Drupal 8.2.6 was released on February 1, 2017 and is the final full bugfix release for the Drupal 8.2.x series. Drupal 8.2.x will not receive any further development aside from critical and security fixes. Sites should prepare to update to 8.3.0 on April 5, 2017. (Drupal 8.3.0-alpha1 is available for testing.)

Bug reports should be targeted against the 8.3.x-dev branch from now on, and new development or disruptive changes should be targeted against the 8.4.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

Version: 8.3.x-dev » 8.4.x-dev

Drupal 8.3.6 was released on August 2, 2017 and is the final full bugfix release for the Drupal 8.3.x series. Drupal 8.3.x will not receive any further development aside from critical and security fixes. Sites should prepare to update to 8.4.0 on October 4, 2017. (Drupal 8.4.0-alpha1 is available for testing.)

Bug reports should be targeted against the 8.4.x-dev branch from now on, and new development or disruptive changes should be targeted against the 8.5.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

Version: 8.4.x-dev » 8.5.x-dev

Drupal 8.4.4 was released on January 3, 2018 and is the final full bugfix release for the Drupal 8.4.x series. Drupal 8.4.x will not receive any further development aside from critical and security fixes. Sites should prepare to update to 8.5.0 on March 7, 2018. (Drupal 8.5.0-alpha1 is available for testing.)

Bug reports should be targeted against the 8.5.x-dev branch from now on, and new development or disruptive changes should be targeted against the 8.6.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

Version: 8.5.x-dev » 8.6.x-dev

Drupal 8.5.6 was released on August 1, 2018 and is the final bugfix release for the Drupal 8.5.x series. Drupal 8.5.x will not receive any further development aside from security fixes. Sites should prepare to update to 8.6.0 on September 5, 2018. (Drupal 8.6.0-rc1 is available for testing.)

Bug reports should be targeted against the 8.6.x-dev branch from now on, and new development or disruptive changes should be targeted against the 8.7.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

Version: 8.6.x-dev » 8.8.x-dev

Drupal 8.6.x will not receive any further development aside from security fixes. Bug reports should be targeted against the 8.8.x-dev branch from now on, and new development or disruptive changes should be targeted against the 8.9.x-dev branch. For more information see the Drupal 8 and 9 minor version schedule and the Allowed changes during the Drupal 8 and 9 release cycles.

Version: 8.8.x-dev » 8.9.x-dev

Drupal 8.8.7 was released on June 3, 2020 and is the final full bugfix release for the Drupal 8.8.x series. Drupal 8.8.x will not receive any further development aside from security fixes. Sites should prepare to update to Drupal 8.9.0 or Drupal 9.0.0 for ongoing support.

Bug reports should be targeted against the 8.9.x-dev branch from now on, and new development or disruptive changes should be targeted against the 9.1.x-dev branch. For more information see the Drupal 8 and 9 minor version schedule and the Allowed changes during the Drupal 8 and 9 release cycles.

catch’s picture

Status: Active » Closed (outdated)

This should have been posted against media module I think. Rendering of embedded media items is completely different in Drupal 9, so marking this as outdated.