<p>That will get you the url of the current user's photo. To get an author's photo do this:</p>
<pre><code>{{ author.photoUrl }}
</code></pre>
<p>If the author is not defined in your context but the entry is, then get the entry's author's photo as follows:</p>
<pre><code>{{ entry.author.photoUrl }}
</code></pre>
<p>In Craft 4, the following should be used:</p>
<pre><code>{{ entry.author.photo.url ?? '' }}
</code></pre>

CC BY-SA 4.0
2022-11-28T12:57:59.803Z
This method is now deprecated. Does anyone know the current method? The documentation says "Use getPhoto().getUrl() instead." but when I try entry.author.getPhoto().getUrl() I get an error.
Jim Pannell
CC BY-SA 4.0
2022-11-28T14:00:04.393Z
If either the author or photo is not set, it will result in an error. I've updated my answer with a Craft 4 version that falls back to an empty string.
Ben Croker
CC BY-SA 4.0
2022-11-29T11:25:43.343Z
Thanks @Ben Croker. Hope life is good!
Jim Pannell
CC BY-SA 4.0
2014-06-24T16:15:29.320Z
2022-11-28T13:59:10.550Z
2022-11-28T13:59:10.550Z
Ben Croker
<p>This might be a stupid question... but I can't seem to figure it out. </p>

<p>I'd like to show the photo of an author beside their entry. I thought the proper variable was... </p>

<pre><code>{{user.photoUrl}}
</code></pre>

<p>...until I logged out and my photo disappeared. </p>

<users>
How do I display the Image of an Author in a post?
# How do I display the Image of an Author in a post?

(Asked by: username_0 on 2014-06-24)

This might be a stupid question... but I can't seem to figure it out. 
I'd like to show the photo of an author beside their entry. I thought the proper variable was... 
{{user.photoUrl}}

...until I logged out and my photo disappeared.

**Tags:** users


---

## 1 answers

### Answer by username_1 on 2014-06-24. Score: 12 | Accepted answer

That will get you the url of the current user's photo. To get an author's photo do this:
{{ author.photoUrl }}

If the author is not defined in your context but the entry is, then get the entry's author's photo as follows:
{{ entry.author.photoUrl }}

In Craft 4, the following should be used:
{{ entry.author.photo.url ?? '' }}

> **Comments:**
> **username_2**: This method is now deprecated. Does anyone know the current method? The documentation says "Use getPhoto().getUrl() instead." but when I try entry.author.getPhoto().getUrl() I get an error.  
> **username_1**: If either the author or photo is not set, it will result in an error. I've updated my answer with a Craft 4 version that falls back to an empty string.  
> **username_2**: Thanks @username_1. Hope life is good!  

---

