Trying to display the author photo of the entry (it's there for sure). The Craft 2 way I used entry.author.photoUrl but that is not working so I tried entry.author.photo.url and that does not show anything and no error or warnings.

Is what I am doing correct?

{{ entry.getAuthor().getPhoto().getUrl() }}

Here is the function. Of course if the author has no photo you'll receive nothing (but an exception). Furthermore this function returns the URL not a HTML tag.

  • Thanks Robin! I tried that and still get nothing, even though the profile pic of the author is present. hmmmm
    – Vin
    Apr 25 '18 at 23:33
  • What does entry.getAuthor.photoId or entry.getAuthor().getPhoto().id output? Apr 25 '18 at 23:35
  • That returns 279
    – Vin
    Apr 25 '18 at 23:43
  • Seems like an invalid configuration. You can dump the volume in order to see the url setting. {{ dump(entry.getAuthor().getPhoto().getVolume()) }} there must be an attribute url/ hasUrls if it's empty you have to change the settings in the corresponding volume in your cp Apr 25 '18 at 23:49
  • Thanks again Robin :) . That was it, the config in assets had @storage/userPhotos. Once I changed File System Path to @webroot/images/blogs/userPhotos and made it accessible to public, it worked!
    – Vin
    Apr 26 '18 at 0:28

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.