Skip to main content

If you want to access the file uri in the node you have to iterate over the field in the node:

{% for image in node.field_image %} {% if loop.first %} <div class="class1"> <img src="{{ file_url(image.entity.fileuri) }}" /> <div></div> {% else %} <div class="class2"> <img src="{{ file_url(image.entity.fileuri) }}">" /> </div> {% endif %} {% endfor %} 

If you want to access the file uri in the node you have to iterate over the field in the node:

{% for image in node.field_image %} {% if loop.first %} <div class="class1"> <img src="{{ file_url(image.entity.fileuri) }}" > <div> {% else %} <div class="class2"> <img src="{{ file_url(image.entity.fileuri) }}"> {% endif %} {% endfor %} 

If you want to access the file uri in the node you have to iterate over the field in the node:

{% for image in node.field_image %} {% if loop.first %} <div class="class1"> <img src="{{ file_url(image.entity.fileuri) }}" /> </div> {% else %} <div class="class2"> <img src="{{ file_url(image.entity.fileuri) }}" /> </div> {% endif %} {% endfor %} 
Source Link
4uk4
  • 102.9k
  • 7
  • 176
  • 221

If you want to access the file uri in the node you have to iterate over the field in the node:

{% for image in node.field_image %} {% if loop.first %} <div class="class1"> <img src="{{ file_url(image.entity.fileuri) }}" > <div> {% else %} <div class="class2"> <img src="{{ file_url(image.entity.fileuri) }}"> {% endif %} {% endfor %}