org.sakaiproject.profile2.model
Class ProfileImage

java.lang.Object
  extended by org.sakaiproject.profile2.model.ProfileImage

public class ProfileImage
extends Object

ProfileImageResource

This is a wrapper class which contains fields for all types of profile images. Only one field will be set at any given time.

Use the getBinary or getUrl methods to do the work and return the data as either a String or byte[]. If String, this will be a URL/URI you can use directly. If byte[] this will be the uploaded image. Consult both.

Note. Eventually, this will return only Strings. The byte[] will be base64 encoded and returned as a data URI you can use, however this is not supported in browsers older than IE8 (Safari, Firefox, Chrome, all ok though).

You can get alt text for the image via getAltText()

This is not related to the similarly named hibernate model (hbm.model.ProfileImage)

Author:
Steve Swinsburg (steve.swinsburg@gmail.com)

Constructor Summary
ProfileImage()
           
 
Method Summary
 byte[] getBinary()
          Get access to the binary data from either the uploaded image or the base64 encoded data
 String getUrl()
          Get access to the URL from either the external image that a user can set, or an official image.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ProfileImage

public ProfileImage()
Method Detail

getBinary

public byte[] getBinary()
Get access to the binary data from either the uploaded image or the base64 encoded data

Returns:
byte[] or null if none

getUrl

public String getUrl()
Get access to the URL from either the external image that a user can set, or an official image.

Returns:
url or null.


Copyright © 2008-2013 The Sakai Foundation. All Rights Reserved.