If I use the width and/or height dimension views fields, instead of showing the width and height of the image (in text) I instead get the full image.
Steps to reproduce:
1) Install media_entity_image and it's dependencies
2) Create image media bundle
3) Add image field
4) Add a image entity
5) Create a view, showing media entities
6) Include a field, either Media: Thumbnail (height) or Media: Thumbnail (width)
You will notice the field formatter in use is for the image field, and not that of a text field.
Expected result:
I should get the image dimensions, in text
Actual result:
The actual image is displayed.
Comment | File | Size | Author |
---|---|---|---|
#4 | Untitled.pdf | 117.85 KB | Allie Micka |
Comments
Comment #2
Dippers CreditAttribution: Dippers commentedI needed the image height and width in a view and needed to add the following code to expose them.
Comment #3
SebaZ CreditAttribution: SebaZ commentedI can confirm that it still works wrong as described in issue, Drupal 8.9 core Media module, not only this contrib.
Comment #4
Allie MickaWhile not ideal, you can use the thumbnail height/width fields and access the raw height/width values as tokens. To output this information, go to 'Rewrite results' in the field settings and add the token.
Comment #5
vlad.dancerThanks @Dippers, works even in 2023!
I've used this hook for paragraph image field. I think this issue should be moved into core.
Comment #6
vamirbekyan CreditAttribution: vamirbekyan commentedthis method outputs width and height of the original image and not of the selected thumbnail selected in the Formatter.
Anyone knows how to output the selected thumbnail height and width?