Thanks a lot Apoorva for this post. But here is my predicament: I retrieve a user from Liferay DB, based on his screenName or emailID. Then i retrieve all the users that belong to the group that this user belongs to. So when i retrieve those users (lets call them his buddies), I wanna be able to retrieve their profile pictures as well. All this, i do in the java class. So will i have to pass on eash user object to the jsp files containing above snippets and then retrieve the image object in the jsp? Or could there be a straight forward way.
Thanks a lot Apoorva for this post.
ReplyDeleteBut here is my predicament:
I retrieve a user from Liferay DB, based on his screenName or emailID. Then i retrieve all the users that belong to the group that this user belongs to. So when i retrieve those users (lets call them his buddies), I wanna be able to retrieve their profile pictures as well. All this, i do in the java class. So will i have to pass on eash user object to the jsp files containing above snippets and then retrieve the image object in the jsp? Or could there be a straight forward way.
Thanks a lot once again :)
Praveen,
DeleteIn java, you get change as following:
String path = user.isFemale()? "female" : "male" + "_portrait?img_id=" + Long.valueOf(user.getPortraitId()) + "&t=" + Long.valueOf(ImageServletTokenUtil.getToken (user.getPortraitId()));
you can use this code in conjuction with themeDisplay on JSp.
Hope this will help.
Thanks Apoorva...
DeleteBut i wanna do this in Java and not inside a jsp.. Is it possible?
Apoorva,
ReplyDeleteI used the below code to retrieve the user image object and it worked fine for me :)
long portraitId = user.getPortraitId();
Image image = ImageLocalServiceUtil.getImage(portraitId);
That's great...
Delete