2

Craft 3: I'm trying to get User Photo URL WITHOUT any transforms, but none of those options seems to work: (some of it prints the url with some transform)

user.photo
user.getPhoto()
user.getPhoto('original')
user.getPhotoUrl()
user.getPhotoUrl('original')
user.photoUrl()
user.photoUrl('original')

There is no DOCs for this yet on the craft 3 site. Anyone know? Thanks

0
3

According to the Craft 3 source code, User::getPhotoUrl() has been deprecated. Use getPhoto() to access the photo asset (if there is one), and call its getUrl() method to access the photo URL. (Also mentioned in the changelog.)

So assuming you've set user to something already in your template, the correct way to get the photo in Craft 3 is:

{{ user.photo.url() }}
1
  • 1
    To be absolutely clear about the no transformation (not even a default one): {{ user.photo.url(null) }} or {{ user.photo.url(false) }} Mar 8 '18 at 19:49

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.