How do you get the url of an image in a view twig template?

Solutions

There is a raw variable available - you can use it to get raw result from the query, with all data it fetched. You can inspect it with the devel or twig_vardumper module using xdebug or dump(raw). More about debugging twig templates: https://www.drupal.org/docs/8/theming/twig/debugging-twig-templates#s-viewing-variables

Tags: Views

Similar questions

How to use 2 twig template for for one field (or how to add a variable to a template from a template)
Let say I have a node template which is calling twice the same field like the following: I also have a preprocessing function which is adding VAR1 and VAR2 to the 'my_field' array like the following: I would like that the first call of 'My_field' use the default twig template and the 'VAR1' value... As you can imagine, I could do it as this is the ...
Getting a custom block image field URL in the block Twig template
I have a custom block containing a text field and an image field. I would like to render the block so that the image's URL can be defined as a data attribute of the block's wrapper div so that it can be used by a javascript function to create a parallax background effect behind the text field. If I make a template file block.parallax.html.twig, I a...
How to find image style URL from within twig template?
I'm implementing a node template that uses an image twice; once in a 'normal' way (i.e. using the image style defined in the field's display configuration for that view mode), and the other is as a css background-image property. I need one of two things: (ideally) a way to get the URL for a different image style of the same image. a way to get the ...
How to retrieve image URL from Media Bundle field in Twig Template
I have created a custom media bundle using the Media Entity module. Here is a screen grab of the media bundle: I have created a Twig template media--image.twig.html I am able to retrieve all of the field values via the content variable in Twig but I'm having difficulty retrieving the field_image URL. Here is a snapshot of the output from {{ kint(co...
How to access url of Remote Video, Document and Image inside twig template?
I have a field called Media (machine name: field_media) inside of a content type. This field Media takes the media types of Remote video, Image, and Documents. I am currently trying to render this media inside my twig template as a link to whatever media type it is. For example, if it's a remote youtube video, the link would take you to the video o...
How to print and/or manipulate individual image attributes and suppress width and height via the image.html.twig template
I had to get rid of the width and height attributes in my images and wanted to learn better the possibilites of Twig in Drupal.

Also ask

We use cookies to deliver the best possible experience on our website. By continuing to use this site, accepting or closing this box, you consent to our use of cookies. To learn more, visit our privacy policy.