I am working on Drupal 8 finally and using the replacement for Krumo which is Kint. It packs a lot more information in than Krumo did, and came with a bit of confusion.

While trying to get the image uri of an image that was rendered via a content type, the uri was not listed. I did however find an answer here Get Image URL in Twig .

And I saw that my reference needed .entity.uri.value prepended to it. This worked, but after further inspection of my node tree in kint I could not find anything the led to .entity as a reference. So how do I found out what to appended to my node tree reference if it is not listed?

1 Answer 1


Every image in Drupal 8 is a file entity.

You can try in template_preprocess_node():

$image_file_id = $variables['node']->field_image[0]->target_id;
$image_file = \Drupal\file\Entity\File::load($image_file_id);
$uri = $image_file->uri->value;
  • It seems there is just an image file id in kint without uri info
    – Andrew Nim
    Nov 16, 2016 at 20:52

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.