掲示板

Get images from Liferay DL whose id is stored in separate database table

10年前 に Seeya S Kudtarker によって更新されました。

Get images from Liferay DL whose id is stored in separate database table

Regular Member 投稿: 187 参加年月日: 13/01/16 最新の投稿
I have an Employee table which stores details of Employees (name,date of birth etc) I have a field in Employee table named fileEntryId which stores the Id of the employee pics which are stored in DL in liferay. What I want to do is if the fileEntryId in Employee matches with fileEntryId of the dlfileEntry table of the Document Library then display the images in the search container along with details from Employee table.

How do I do this?
thumbnail
10年前 に Amit Doshi によって更新されました。

RE: Get images from Liferay DL whose id is stored in separate database tabl

Liferay Master 投稿: 550 参加年月日: 10/12/29 最新の投稿
Seeya S Kudtarker:
I have an Employee table which stores details of Employees (name,date of birth etc) I have a field in Employee table named fileEntryId which stores the Id of the employee pics which are stored in DL in liferay. What I want to do is if the fileEntryId in Employee matches with fileEntryId of the dlfileEntry table of the Document Library then display the images in the search container along with details from Employee table.

How do I do this?


Why you need to compare fileEntryId that stored in the Employee table with the Document Library fileEntryId.

Just Do Simple Thing.

In Search Container you will get the fileEntryId from the Employee table

And use the below code to get the image from it.

DLFileEntry image = DLFileEntryLocalServiceUtil
.getFileEntry(employee.getfileEntryId());
String imageURL = "/documents/" + image.getGroupId() + "/" + image.getFolderId() + "/" + image.getTitle()+"/"+image.getUuid();

Put the imageURL in the src attribute of html image tag and also specify height and width and your work is done.

Thanks & Regards,
Amit Doshi
10年前 に Seeya S Kudtarker によって更新されました。

RE: Get images from Liferay DL whose id is stored in separate database tabl

Regular Member 投稿: 187 参加年月日: 13/01/16 最新の投稿
Hey Amit,

Thanks that works but I have a little problem here.
All the images are displayed in each row. What I mean is suppose if I have 7 entries in the employee table (7 employees) then When I am displaying in the search container, all the 7 images are displayed for each employee
10年前 に Mohamed Faisal によって更新されました。

RE: Get images from Liferay DL whose id is stored in separate database tabl

Junior Member 投稿: 90 参加年月日: 09/08/12 最新の投稿
It is working fine. Thanks.

Regards,
Faisa;l
thumbnail
10年前 に Vilmos Papp によって更新されました。

RE: Get images from Liferay DL whose id is stored in separate database tabl

Liferay Master 投稿: 529 参加年月日: 10/10/21 最新の投稿
If you have a 1:1 connection to User_ table, then you could use the user's portait which url is accessible like this:
user.getPortraitURL();

If you have no this connection, than you have to deal with the document library entries like stated above, but if your employees has a login to the portal, that would be pretty straight forward to have them as users as well and they could edit their accounts and change their pictures.
10年前 に Seeya S Kudtarker によって更新されました。

RE: Get images from Liferay DL whose id is stored in separate database tabl

Regular Member 投稿: 187 参加年月日: 13/01/16 最新の投稿
Vilmos,
Thanks Vilmos for the reply.
In the application that I am developing, the images of employees are stored by the person who will be filling the details. The employees may/may not get to use them. Well thanks for this info I will have to think about this too. Thanks for the idea. emoticon Simple but it never occured.. emoticon

Regards

Seeya