fm:UserAvatar


This component will display a users' avatar.
If the user hasn't uploaded an avatar to Newzulu Platform, the most appropriate avatar will be picked based on the user's registration type, gender and other criteria.

Avatars are chosen in this order:

  1. Newzulu Platform media ID if specified as avatar in user data
  2. Facebook profile picture, if logged in with Facebook
  3. Gravatar, if account exists for user email address
  4. Component-specified gender default (male, female or neutral if gender not specified)
  5. Newzulu Platform gender default (Mr. & Mrs. Grey, or Pat - our androgynous friend)

Example

<fm:UserAvatar uid="1" width="50" />

In this example, the avatar for user with ID '1' will be returned as HTML with a width attribute: <img src="/static/1/images/global/male11.png" width="50" alt="Firsty McLastname"/>

Supported attributes

NameRequiredDefaultDescription
femaleDefaultOptionalRelative link to the default female image you would like to show if the user has not specified any
heightOptionalEither the width or the height in pixels is required. Must be at least 1.
maleDefaultOptionalRelative link to the default male image you would like to show if the user has not specified any
neutralDefaultOptionalRelative link to the default neutral image you would like to show if the user has not specified any
uidRequiredThe user's id
varOptionalUsing this attribute allows you to assign the Avatar path in a template variable, as opposed to displaying the Avatar itself. Please refer to Example 5 to see how to use this functionality.
widthRequiredEither the width or the height in pixels is required. Must be at least 1.

Deprecated Attributes

Template variables

This component defines no template variables.

See also

More examples

This displays bunch of user avatars in a list, defaulting to gender images uploaded to Newzulu Platform. The avatars will link to their profile page.

<fm:UserList fields="id"> <fm:Loop> <a href="/profile/{$$user.id}"> <fm:UserAvatar uid="{$$user.id}" width="50" neutralDefault="1365467" maleDefault="1365468" femaleDefault="1365469" /> </a> <br /> </fm:Loop> </fm:UserList>

This displays a users avatar that will maintain aspect ratio but will be a maximum of 200px in height. If the user doesn't have an avatar specified, isn't logged in with Facebook and doesn't have a Gravatar account, the Newzulu Platform gender defaults are used.

<fm:UserAvatar uid="{$$user.id}" height="200" />

This displays an avatar with constrained proportions as to always return a square image.

<fm:UserAvatar uid="{$$user.id}" width="100" height="100" />