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 URL for the image field.
I’m struggling to use dump()
and kint()
to help myself to an answer. They both output far far too much (thanks to embedded links to “parent” etc.) and seem to not have the info I need. e.g. looking at dump(content.field_image)
output the actual URL of the image is not there (so where does it come from such that it can be rendered with {{ content.field_image }}
?!). kint()
on the other hand dies completely if I pass an argument to it and the top-level version is again far too big to navigate. Debugging was soo much easier with phptemplate + xdebug. (Yes I know it’s good that themers can’t drop the database.)
There’s an answer to (1) that implies you can’t do it, but I don’t understand why I can’t get the existing URL in (2)?