User Avatar Basics
An "avatar" is an image that represents you online—a little picture that appears next to your name when you interact with websites.
Comflow users can have an avatar to accompany their account. The avatar is used to mark the menu option for user settings and session details.
Enable Avatars in Portal
Avatars are enabled and disabled with a property in sitedef
. Default value is false
. This property will control avatars for all users.
<Property name="portal.user.avatar.enabled" value="true"/>
<!-- Possible values are true and false. Default value is false.-->
The property value can be retrieved with method net.comactivity.core.site.Site#isPortalUserAvatarEnabled
.
Avatar Types
Comflow has three options for user avatars: gravatar
, local
, and custom
. There's a property that sets a default avatar type for all users, but users can also choose their own avatar type under My Settings. The local
option is default.
<Property name="portal.user.avatar.type.default" value="local"/>
<!-- Possible values are gravatar, local, and custom. Default value is local.-->
The property value can be retrieved with method net.comactivity.core.site.Site#getPortalUserAvatarTypeDefault
.
Enum AvatarType
Valid avatar types are available as constants in the enum AvatarType
.
Avatar Type Gravatar
A Gravatar is a Globally Recognized Avatar. You upload it and create your profile just once, and then when you participate in any Gravatar-enabled site, your Gravatar image will automatically follow you there.
Gravatar is a free service for site owners, developers, and users. It is automatically included in every WordPress.com account and is run and supported by Automattic.
If avatar type is set to gravatar
, the avatar image will be retrieved from the Gravatar service with eMail
in UserData
.
Avatar Type Local
The local avatar type uses avatar images from a file location that the Tomcat can access. It is possible to set the location with a property in sitedef
. Default value is $PersistanceRoot/Avatars
.
<Property name="portal.user.avatar.images.location" value="../../../../tomcat/avatars/"/>
<!-- Possible values are absolute or relative paths.-->
The property value can be retrieved with method net.comactivity.core.site.Site#getPortalUserAvatarImagesLocation
.
Local avatar images will be retrieved with chosen file format and loginName
in UserData
, e.g. comflow.png
.
Default file format for local avatar images is PNG
. Available formats are determined by the standard image format plugins available to javax.imageio.ImageIO
. Available formats should include JPEG
, PNG
, GIF
, BMP
and WBMP
. If an other file format than default PNG
will be used it has to be set in sitedef
. The file format will also be used as a file extension when reading and writing images.
<Property name="portal.user.avatar.images.format" value="png"/>
<!-- Possible values are lowercase representations if file formats available to javax.imageio.ImageIO.-->
<!-- Possible values should include jpg, png, gif, bmp, and wbmp.-->
The property value can be retrieved with method net.comactivity.core.site.Site#getPortalUserAvatarImagesFormat
.
Avatar Type Custom
With avatar type custom
it is possible to implement a custom service for avatar images. The service should be an ApplicationService
and set in sitedef
. There is no default value. For more information, see section Custom Avatar Service.
<Property name="portal.user.avatar.custom.service" value="CustomAvatarService"/>
<!-- Possible values are registered application services. -->