I am trying to show image via view twig file and below is my lin eof code:

<img width="220" height="112" src="{{ file_url(content.field_thumbnail_new[key]['#item'].entity.uri.value )}}" alt="{{ item.alt }}" />

When inspecting, I see the below:

enter image description here

any help on how this can be fixed pls?! I am using D9.

  • Why is this not rendered normally?
    – Kevin
    Jul 2, 2021 at 20:02
  • I'm not sure. But per the recommended link, I added URL image formatter and added the field as {{ fields.field_thumbnail_new.content }} on my twig. Also I changed the image as "image URI" in view field settings. It worked.
    – Rick
    Jul 3, 2021 at 11:07

1 Answer 1


I would recommend to use https://www.drupal.org/project/twig_tweak module.

<img src="{{ drupal_field('field_thumbnail_new', 'node', node.id, {type: 'image_url', settings: {image_style: 'YOUR_IMAGE_STYLENAME'}}) }}"  />
  • Thanks! I have added a comment on how i fixedit
    – Rick
    Jul 3, 2021 at 11:07

Not the answer you're looking for? Browse other questions tagged or ask your own question.