public class SafeProfileImageProvider extends AbstractLogEnabled implements ProfileImageProvider, Serviceable
ProfileImageProvider.UserProfileImage
Modifier and Type | Field and Description |
---|---|
protected static String |
__DEFAULT_FILE_NAME
Name of the default image
|
protected static String |
__USER_PROFILES_DIR_PATH
Relative path of the user profiles directory, which contains all the image subdirectories
|
protected SourceResolver |
_sourceResolver
Source resolver
|
protected UserManager |
_userManager
Users manager
|
ROLE
Constructor and Description |
---|
SafeProfileImageProvider() |
Modifier and Type | Method and Description |
---|---|
private Source |
_getGravatarImageSource(UserIdentity userIdentity,
Integer size)
Get the source of a gravatar image
|
protected ProfileImageProvider.UserProfileImage |
getDefaultImage()
Get the default user image
|
protected ProfileImageProvider.UserProfileImage |
getGravatarImage(UserIdentity user,
int size)
Get gravatar image
|
ProfileImageProvider.UserProfileImage |
getImage(UserIdentity user,
String imageSource,
int size,
int maxSize)
Get the avatar
|
boolean |
hasGravatarImage(UserIdentity user)
Test if the gravatar image exists
|
void |
service(ServiceManager smanager) |
enableLogging, getLogger, setupLogger, setupLogger, setupLogger
protected static final String __USER_PROFILES_DIR_PATH
protected static final String __DEFAULT_FILE_NAME
protected SourceResolver _sourceResolver
protected UserManager _userManager
public SafeProfileImageProvider()
public void service(ServiceManager smanager) throws ServiceException
service
in interface Serviceable
ServiceException
public ProfileImageProvider.UserProfileImage getImage(UserIdentity user, String imageSource, int size, int maxSize) throws ProcessingException
ProfileImageProvider
getImage
in interface ProfileImageProvider
user
- The userimageSource
- The image source. Can be null to get the default onesize
- The size in px. Can be 0.maxSize
- The maxSize in px. Can be 0.ProcessingException
- If an error occurredprotected ProfileImageProvider.UserProfileImage getDefaultImage()
protected ProfileImageProvider.UserProfileImage getGravatarImage(UserIdentity user, int size)
user
- The usersize
- The image sizeprivate Source _getGravatarImageSource(UserIdentity userIdentity, Integer size) throws IOException
userIdentity
- The usersize
- The requested sizeIOException
- If an error occurs while resolving the source uripublic boolean hasGravatarImage(UserIdentity user)
user
- The user