Forums de discussion
how to upload and show image using JSF portlet?
Aritra Ghosh, modifié il y a 12 années.
how to upload and show image using JSF portlet?
Junior Member Publications: 62 Date d'inscription: 08/11/11 Publications récentes
Hello,
I want to build a profile image uploader using JSF+Icefaces portlet.I am using liferay 6.1.Actually I want to upload a profile picture of fixed size,show preview of the picture after uploading.Previously I used file uploader using Icefaces component.Can anyone give me suggestion or share a link?
Thanks & regards,
Aritra Ghosh
I want to build a profile image uploader using JSF+Icefaces portlet.I am using liferay 6.1.Actually I want to upload a profile picture of fixed size,show preview of the picture after uploading.Previously I used file uploader using Icefaces component.Can anyone give me suggestion or share a link?
Thanks & regards,
Aritra Ghosh
Neil Griffin, modifié il y a 12 années.
RE: how to upload and show image using JSF portlet?
Liferay Legend Publications: 2655 Date d'inscription: 27/07/05 Publications récentes
After you upload the image, will you be calling Liferay's UserLocalServiceUtil.updatePortrait(long userId, byte[] bytes) method in order to update the Liferay user profile image?
Aritra Ghosh, modifié il y a 12 années.
RE: how to upload and show image using JSF portlet?
Junior Member Publications: 62 Date d'inscription: 08/11/11 Publications récentes
Thanks Neil for your reply.I can convert an jpg image to byte array.So,the calling of UserLocalServiceUtil.updatePortrait(long userId, byte[] bytes) can be done.But,to show the image again in JSF portlet,should I use h:graphicImage tag?Can you give me a more details.
Regards,
Aritra
Regards,
Aritra
Aritra Ghosh, modifié il y a 12 années.
RE: how to upload and show image using JSF portlet?
Junior Member Publications: 62 Date d'inscription: 08/11/11 Publications récentes
Neil,FYI I am able to upload the profile picture for a user.This image can be seen from that user's account.But for user creation I am using my own portlet.Eventually I would like to show the image in that custom portlet.
Regards,
Aritra
Regards,
Aritra
Neil Griffin, modifié il y a 12 années.
RE: how to upload and show image using JSF portlet?
Liferay Legend Publications: 2655 Date d'inscription: 27/07/05 Publications récentes
Very sorry about this -- I originally wrote the following text on April 27, 2012 but I must have clicked on the "Save as Draft" button instead of "Publish". -- Neil
-------------
If you have Liferay Faces Portal as a dependency in your portlet, then you can do something like this:
Where 1234 = the value of com.liferay.portal.model.User.getUserId().
Alternatively you can specify a User object in the EL like this:
-------------
If you have Liferay Faces Portal as a dependency in your portlet, then you can do something like this:
<img src="#{liferay.portraitURL['1234']}">
Where 1234 = the value of com.liferay.portal.model.User.getUserId().
Alternatively you can specify a User object in the EL like this:
<ui:repeat value="#{modelBean.users}" var="user">
<img src="#{liferay.portraitURL['user']}">
</ui:repeat>
Bill Dolan, modifié il y a 10 années.
RE: how to upload and show image using JSF portlet?
New Member Publications: 16 Date d'inscription: 29/06/10 Publications récentes
I have found success using getPortraitId() instead of getUserId()
I use the expression to evaluate value of bean.portraitIdValue. If empty, replace with broken image graphic.
<ice:graphicimage value="#{not empty bean.portraitIdValue ? liferay.portraitURL[bean.portraitIdValue] : '/documents/10180/path to broken image graphic'}" />
if (cellUserList[col] != null) {
User cellUser = cellUserList[col];
return cellUser.getPortraitId();
I use the expression to evaluate value of bean.portraitIdValue. If empty, replace with broken image graphic.
Giuseppe Pantaleo, modifié il y a 11 années.
RE: how to upload and show image using JSF portlet?
New Member Publications: 15 Date d'inscription: 18/06/12 Publications récentes
Hi, I'm experiencing the same issue. Have you solved the problem?