public interface ProfileImageLogic
Also takes care of image conversion from classic Profile to Profile2
| Modifier and Type | Method and Description |
|---|---|
boolean |
addGalleryImage(String userUuid,
byte[] imageBytes,
String mimeType,
String fileName)
Add a gallery image for the specified user.
|
ProfileImage |
getBlankProfileImage()
Get the blank profile image, the one a user sees if there is
no other image available.
|
List<GalleryImage> |
getGalleryImages(String userUuid)
Retrieves all gallery images for the specified user.
|
int |
getGalleryImagesCount(String userUuid)
Get a count of the number of gallery images for a user
|
List<GalleryImage> |
getGalleryImagesRandomized(String userUuid)
Retrieves all gallery images in randomized order for the specified user.
|
String |
getGravatarUrl(String userUuid)
Generate a gravatar URL for a user
URLs are of the form http://www.gravatar.com/avatar/HASH?
|
ProfileImage |
getOfficialProfileImage(String userUuid,
String siteId)
Gets the official profile image for a user.
|
ProfileImage |
getProfileImage(Person person,
int size)
Get the profile image for a user.
|
ProfileImage |
getProfileImage(Person person,
int size,
String siteId)
Get the profile image for a user.
|
ProfileImage |
getProfileImage(String userUuid,
ProfilePreferences prefs,
ProfilePrivacy privacy,
int size)
Get the profile image for a user.
|
ProfileImage |
getProfileImage(String userUuid,
ProfilePreferences prefs,
ProfilePrivacy privacy,
int size,
String siteId)
Get the profile image for a user.
|
String |
getProfileImageEntityUrl(String userUuid,
int size)
Get the entity url to a profile image for a user.
|
String |
getUnavailableImageThumbnailURL()
Get the full URL to the default unavailable image thumbnail defined in ProfileConstants
|
String |
getUnavailableImageURL()
Get the full URL to the default unavailable image defined in ProfileConstants
|
boolean |
profileImageIsDefault(String userUuid)
Does this use have a default profile image?
|
boolean |
removeGalleryImage(String userId,
long imageId)
Remove the specified gallery image.
|
boolean |
resetProfileImage(String userUuid)
Reset the profile image for a user
|
boolean |
saveOfficialImageUrl(String userUuid,
String url)
Save the official image url that institutions can set.
|
boolean |
setExternalProfileImage(String userUuid,
String fullSizeUrl,
String thumbnailUrl,
String avatar)
Update the profileImage for a user given the URL to an image
Will work, but not have visible effect if the setting for the image type used in sakai.properties is not url. ie its using an uploaded image instead
|
boolean |
setUploadedProfileImage(String userUuid,
byte[] imageBytes,
String mimeType,
String fileName)
Update the profile image for a user given the byte[] of the image.
|
ProfileImage getBlankProfileImage()
ProfileImage getProfileImage(String userUuid, ProfilePreferences prefs, ProfilePrivacy privacy, int size)
If making a request for your own image
If making a request for someone else's image
The returned ProfileImage object is a wrapper around all of the types of image that can be set. use the getBinarty and getUrl() methods on this object to get the data. See the docs on ProfileImage for how to use this.
userUuid - prefs - privacy - size - ProfileImage getOfficialProfileImage(String userUuid, String siteId)
userUuid - siteId - siteId to check that the requesting user has roster.viewofficialphoto permissionProfileImage getProfileImage(String userUuid, ProfilePreferences prefs, ProfilePrivacy privacy, int size, String siteId)
userUuid - prefs - privacy - size - siteId - - optional siteid to check if the current user has permissions in this site to see the target user's image (PRFL-411)ProfileImage getProfileImage(Person person, int size)
person - Person object that contains all info about a usersize - size of image to return.ProfileImage getProfileImage(Person person, int size, String siteId)
person - Person object that contains all info about a usersize - size of image to return.siteId - - optional siteid to check if the current user has permissions in this site to see the target user's image (PRFL-411)boolean setUploadedProfileImage(String userUuid, byte[] imageBytes, String mimeType, String fileName)
Will work, but not have visible effect if the setting for the image type used in sakai.properties is not upload. ie its using URL instead
userUuid - - uuid for the userimageBytes - - byte[] of imagemimeType - - mimetype of image, ie image/jpegfilename - - name of file, used by ContentHosting, optional.boolean setExternalProfileImage(String userUuid, String fullSizeUrl, String thumbnailUrl, String avatar)
Will work, but not have visible effect if the setting for the image type used in sakai.properties is not url. ie its using an uploaded image instead
userUuid - - uuid for the userfullSizeUrl - - url for main imagethumbnailUrl - - thumbnail for main image to be used when thumbnail sizes are requested.
Leave blank or null for none and when a thumbnail is requested it will return the full image which can be scaled in the markup.avatar - - avatar for main image to be used when avatar sizes are requested. Can be blank and it will fallback as per thumbnailString getUnavailableImageURL()
String getUnavailableImageThumbnailURL()
boolean addGalleryImage(String userUuid, byte[] imageBytes, String mimeType, String fileName)
userUuid - the ID of the user.imageBytes - the image bytes.mimeType - the MIME type of the image.fileName - the filename of the image.true if the gallery image is successfully added,
false if the gallery image is not added.List<GalleryImage> getGalleryImages(String userUuid)
userUuid - the ID of the user.List<GalleryImage> getGalleryImagesRandomized(String userUuid)
userUuid - the ID of the user.boolean removeGalleryImage(String userId, long imageId)
userUuid - the user ID.imageUuid - the image ID.true if the gallery image is successfully removed,
false if the gallery image is not removed.boolean saveOfficialImageUrl(String userUuid, String url)
userUuid - uuid of the userurl - url to imageString getProfileImageEntityUrl(String userUuid, int size)
userUuid - uuid for the usersize - size of image, from ProfileConstantsint getGalleryImagesCount(String userUuid)
userUuid - uuid for the userString getGravatarUrl(String userUuid)
URLs are of the form http://www.gravatar.com/avatar/HASH?s=200 where HASH is an MD5 hash of the user's email address and s is the size. We always use the larger size (200) and then scale it in the markup where required, to take advantage of caching.
If no email address for the user, returns null.
userUuid - uuid for the userboolean resetProfileImage(String userUuid)
userUuid - uuid for the userboolean profileImageIsDefault(String userUuid)
userUuid - uuid for the userCopyright © 2008–2018 The Sakai Foundation. All rights reserved.