[Building Sakai] Profile2 user image

Steve Swinsburg steve.swinsburg at gmail.com
Thu Oct 27 15:21:59 PDT 2011


Hi,

You can use the following URL directly in your HTML to get a user's image:

/direct/profile/userid/image

This will always return a (privacy and preference checked) image and according to any config you have in sakai.properties for Profile2. You can read more about it here:

http://nightly2.sakaiproject.org:8082/direct/profile/describe

Retrieve the profile image for a user. Append /thumb to get the thumbnail (/profile/USER/image/thumb) if there is one. If there is no thumbnail, the main image will be returned. Optionally add the siteId URL param to allow site permissions to be checked (/profile/USER/image?siteId={siteid} or /profile/USER/image/thumb?siteId={siteid}) Returns binary of the image. Returns default image if no image exists or not allowed. Return 404 if user (or optional siteId) is invalid. Will always return an image if one exists, either by being uploaded or being a url (depending on how the system has been configured - see Profile2 sakai.properties. You can use it directly in an img tag <img src="/profile/USER/image[/thumb]" />, it should always return something. DO NOT specify any return format, ie .xml.

cheers,
Steve


On 28/10/2011, at 8:30 AM, David Wafula wrote:

> Team,
> How do i get (programmatically of course), profile picture  of a user, if all i have is a User object ?
> 
> thanks.
> -- 
> David Wafula
> _______________________________________________
> sakai-dev mailing list
> sakai-dev at collab.sakaiproject.org
> http://collab.sakaiproject.org/mailman/listinfo/sakai-dev
> 
> TO UNSUBSCRIBE: send email to sakai-dev-unsubscribe at collab.sakaiproject.org with a subject of "unsubscribe"

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://collab.sakaiproject.org/pipermail/sakai-dev/attachments/20111028/54f66ae6/attachment.html 


More information about the sakai-dev mailing list