0
votes

Yesterday I began to develop a liferay portlet and I wonder if there is a way to Change the Profile picture within the portlet. My attempt is a workaround which seems ineffective to me but I couldn't find the right API to change it properly.

//Code //java

taglib uri="http://java.sun.com/portlet" prefix="portlet" page import="javax.portlet.PortletRequest" page import="java.util.Map"

//java

Map userInfo = (Map)renderRequest.getAttribute(PortletRequest.USER_INFO); String givenName = (userInfo != null) ? (String)userInfo.get("liferay.user.id") : "";

//javascript

var link_user_x="http://192.168.1.214:8080/group/control_panel/manage?p_p_id=2&p_p_lifecycle=0&p_p_state=pop_up&p_p_mode=view&doAsGroupId=18&refererPlid=10427&_2_struts_action=/my_account/edit_user_portrait&_2_redirect=http://192.168.1.214:8080/group/control_panel/manage?p_p_id=2&p_p_lifecycle=0&p_p_state=maximized&p_p_mode=view&doAsGroupId=18&refererPlid=10427&_2_refererPlid=10427&_2_p_u_i_d=11365&_2_doAsGroupId=18&_2_p_u_i_d=11365&_2_portrait_id=11535";

function profilbild_aendern(x) { if (x==1){ winRef = window.open(link_userx); alert(link_user_x); } }

Klicken sie auf diesen //a href="" onClick="profilbild_aendern(1);return false;"/Link/a/ um Marcels Profilbild zu ändern.

//Ideas

So my attempt is to build the Link I got from the Control Panel dynamic by reading the User Information and put them into the link. I figure out where to change it after this post.

I hope you could help me with a "how to change the link properly", or with a short code snippet which opens the window to change the profile picture, a function which will be already into liferay but I can´t find it right now would be awesome. Like: String change_picture(url);

1

1 Answers

0
votes

Call UserServiceUtil.updatePortrait(long userId, byte[] bytes).