掲示板

how to upload and show image using JSF portlet?

thumbnail
12年前 に Aritra Ghosh によって更新されました。

how to upload and show image using JSF portlet?

Junior Member 投稿: 62 参加年月日: 11/11/08 最新の投稿
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
thumbnail
12年前 に Neil Griffin によって更新されました。

RE: how to upload and show image using JSF portlet?

Liferay Legend 投稿: 2655 参加年月日: 05/07/27 最新の投稿
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?
thumbnail
11年前 に Aritra Ghosh によって更新されました。

RE: how to upload and show image using JSF portlet?

Junior Member 投稿: 62 参加年月日: 11/11/08 最新の投稿
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
thumbnail
11年前 に Aritra Ghosh によって更新されました。

RE: how to upload and show image using JSF portlet?

Junior Member 投稿: 62 参加年月日: 11/11/08 最新の投稿
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
thumbnail
11年前 に Neil Griffin によって更新されました。

RE: how to upload and show image using JSF portlet?

Liferay Legend 投稿: 2655 参加年月日: 05/07/27 最新の投稿
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:
<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>
10年前 に Bill Dolan によって更新されました。

RE: how to upload and show image using JSF portlet?

New Member 投稿: 16 参加年月日: 10/06/29 最新の投稿
I have found success using getPortraitId() instead of getUserId()

<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.
11年前 に Giuseppe Pantaleo によって更新されました。

RE: how to upload and show image using JSF portlet?

New Member 投稿: 15 参加年月日: 12/06/18 最新の投稿
Hi, I'm experiencing the same issue. Have you solved the problem?