I have a paragraph type rn-accordion (rn-acc.html.twig), that has a entity reference revision to rn-accordion-section which houses a bunch of different fields. One of which is an image field (bp_image_field); however I am unsure how to reference this field in my twig file. So far I have tried:

      <img src="{{ file_url(paragraph.field_bp_image_field.fileuri) }}" class="img-responsive">

      <img src="{{ file_url(element['#object'].field_bp_image_field.0.entity.uri.value) }}" class="img-responsive">

      <img src="{{ file_url(content.field_bp_image_field['#items'].entity.uri.value) }}" class="img-responsive">

but the output is always

       <img src="/" class="img-responsive">

Can someone help steer me in the right direction?

1 Answer 1


I would suggest not doing this, as you lose the benefits of image styles (the built-in image manipulation feature).

Suggesting you make a hook for this template, pick out the url from the source field, render an image with Drupal APIs, and make the result available as a variable on the template.

  • The images that will be referenced will all be the exact same size and never change, so image manipulation will not be required. Also, I should note that I am not an experienced Drupal developer, so while I appreciate your direction, examples that I could reverse engineer would be more helpful. Thanks.
    – nightowl
    Commented May 17, 2017 at 17:46

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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