0

How to get author_picture URL from a template ? I know that I can use {{ author_picture }} to display the picture; however, all I need is the URL and not the picture. I'm trying to get this URL from the template node--article.html.twig

Here is a similar question but this is different because is base on the field_image. Getting the image URL from a field_image on a node and all I'm trying to get is the author picture.

2
  • Did you try my answer?
    – No Sssweat
    Commented Dec 26, 2015 at 0:55
  • 1
    I have not try it out yet, because I do not want to have a module dependency for a contrib theme that I'm building. I found another workaround ( a theory ) which is trying to get the URL from template field "author_picture" and then call that template inside of the node--article.html.twig. Commented Dec 27, 2015 at 16:21

1 Answer 1

1

URL FORMATTER module

This module add a url formatter for image field. Then you can output image url directly.

Once enabled, go to your user manage fields, and change the picture field formatter to url.

{{ author_picture }}  // will display url instead of picture

If you are using views, views will give you an option to change the format to url.

1
  • I guess there is not other way without using that module. =( Commented Jan 15, 2016 at 9:26

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.