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
Comment #1
drzraf CreditAttribution: drzraf commented(I need to recall myself to retest this now, since 312769b7d7 from #1329586: theme_image_formatter should pass along attributes has been pushed)
Comment #2
drzraf CreditAttribution: drzraf commentedNo, this did not fix it.
Comment #3
tim.plunkettCan you still reproduce this error?
Comment #4
drzraf CreditAttribution: drzraf commentedOf 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+)
Comment #5
drzraf CreditAttribution: drzraf commentedwhich additional information maintainer needs ?
Comment #6
drzraf CreditAttribution: drzraf commentedping ?
Comment #6.0
drzraf CreditAttribution: drzraf commentedoriginal value precision
Comment #15
catchThis 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.