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.

  • Did you try my answer? – No Sssweat Dec 26 '15 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. – itsdarrylnorris Dec 27 '15 at 16:21
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.

  • I guess there is not other way without using that module. =( – itsdarrylnorris Jan 15 '16 at 9:26

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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