Foren
Liferay 6.1 Document and Media for Saving and Retrieving Images
Shamik Hore, geändert vor 12 Jahren.
Liferay 6.1 Document and Media for Saving and Retrieving Images
New Member Beiträge: 10 Beitrittsdatum: 18.04.12 Neueste Beiträge
Hi All,
I am new in Liferay.
I want to add images in Document and Media(inside control panel) programatically. And want to display the images in my custom portlet.
But i m unable to find any useful document...
could you please suggest me how to do ?..
Actually i have used the API DLStoreUtil for adding an image file. and i have successfully added it in - data/document_library/0/1/mydirectory/myfile/1.0 like this.
there are many methods to retrieve the file but i am unable to show the images in my custom portlet. please help me...
i want to know is it the proper location to save and retrieve an image file or is there any other location ?
i have saved the images using byte array.
I have another question when we add a image inside control panel/ Document and media, where all images saved? can you please tell me the path where all the uploaded images saved ....
and how can I save and retrieve images in Document and Media programatically ?
For saving and retrieving this, is there any API available ?
Please help me. I am new in Liferay.
Thanks & Regards,
Shamik
I am new in Liferay.
I want to add images in Document and Media(inside control panel) programatically. And want to display the images in my custom portlet.
But i m unable to find any useful document...
could you please suggest me how to do ?..
Actually i have used the API DLStoreUtil for adding an image file. and i have successfully added it in - data/document_library/0/1/mydirectory/myfile/1.0 like this.
there are many methods to retrieve the file but i am unable to show the images in my custom portlet. please help me...
i want to know is it the proper location to save and retrieve an image file or is there any other location ?
i have saved the images using byte array.
I have another question when we add a image inside control panel/ Document and media, where all images saved? can you please tell me the path where all the uploaded images saved ....
and how can I save and retrieve images in Document and Media programatically ?
For saving and retrieving this, is there any API available ?
Please help me. I am new in Liferay.
Thanks & Regards,
Shamik
Mika Koivisto, geändert vor 12 Jahren.
RE: Liferay 6.1 Document and Media for Saving and Retrieving Images
Liferay Legend Beiträge: 1519 Beitrittsdatum: 07.08.06 Neueste Beiträge
In Liferay Portal 6.1 you need to use DLAppService to add documents/images to Documents and Media. If you use DLStore then that is just the underlaying storage API and anything added through it won't be shown in the portlet as it does not know anything about those files.
Shamik Hore, geändert vor 12 Jahren.
RE: Liferay 6.1 Document and Media for Saving and Retrieving Images
New Member Beiträge: 10 Beitrittsdatum: 18.04.12 Neueste Beiträge
Hi Mika,
Thanks for your reply.
I have saved images using DLAppServiceUtil. But I am facing a problem, that is when i saved the image it is added to the particular folder and and the actual image is not showing. it shows the image default.png.
It looks like -->
<img border="no" style="max-height: 128px; max-width: 128px;" src="/html/themes/control_panel/images/file_system/large/default.png" alt="" id="aui_3_4_0_1_1647">
But when I browse the URL and WebDavURL ,it is showing the uploaded image. Even i can download the image which i uploaded programatically from the Download link in Document and Media Portlet.
But i am not able to find the solution.
Could you please tell me why this is happening?
My code is :-
ThemeDisplay themeDisplay = (ThemeDisplay)actionRequest.getAttribute(WebKeys.THEME_DISPLAY);
long currentUserId = themeDisplay.getUserId();
long DefaultRepositoryId = CompanyConstants.SYSTEM;
User userName = themeDisplay.getUser();
long repositoryId = themeDisplay.getScopeGroupId();
ServiceContext serviceContext = new ServiceContext();
serviceContext.setSignedIn(true);
DLAppServiceUtil.addFileEntry(repositoryId, 19904, imgTitle, imgExt, destination.getName(), "description", "1.0", destination.getAbsoluteFile(), serviceContext);
Here 19904 is parrentFolderId
"1.0" is ChangeLog
destination.getAbsoluteFile() is File file
I have set the serviceContext like - serviceContext.setSignedIn(true);
Can you please tell me why showing the image named "Default.png" insted of my uploaded image ?
Thanks & Regards,
Shamik
Thanks for your reply.
I have saved images using DLAppServiceUtil. But I am facing a problem, that is when i saved the image it is added to the particular folder and and the actual image is not showing. it shows the image default.png.
It looks like -->
<img border="no" style="max-height: 128px; max-width: 128px;" src="/html/themes/control_panel/images/file_system/large/default.png" alt="" id="aui_3_4_0_1_1647">
But when I browse the URL and WebDavURL ,it is showing the uploaded image. Even i can download the image which i uploaded programatically from the Download link in Document and Media Portlet.
But i am not able to find the solution.
Could you please tell me why this is happening?
My code is :-
ThemeDisplay themeDisplay = (ThemeDisplay)actionRequest.getAttribute(WebKeys.THEME_DISPLAY);
long currentUserId = themeDisplay.getUserId();
long DefaultRepositoryId = CompanyConstants.SYSTEM;
User userName = themeDisplay.getUser();
long repositoryId = themeDisplay.getScopeGroupId();
ServiceContext serviceContext = new ServiceContext();
serviceContext.setSignedIn(true);
DLAppServiceUtil.addFileEntry(repositoryId, 19904, imgTitle, imgExt, destination.getName(), "description", "1.0", destination.getAbsoluteFile(), serviceContext);
Here 19904 is parrentFolderId
"1.0" is ChangeLog
destination.getAbsoluteFile() is File file
I have set the serviceContext like - serviceContext.setSignedIn(true);
Can you please tell me why showing the image named "Default.png" insted of my uploaded image ?
Thanks & Regards,
Shamik
Hitoshi Ozawa, geändert vor 12 Jahren.
RE: Liferay 6.1 Document and Media for Saving and Retrieving Images
Liferay Legend Beiträge: 7942 Beitrittsdatum: 24.03.10 Neueste Beiträge
Try Control Panel -> Server Administration -> Reindex all indexes
If this fixes your problem, it means you need to reindex after you upload the image files.
If this fixes your problem, it means you need to reindex after you upload the image files.
Shamik Hore, geändert vor 12 Jahren.
RE: Liferay 6.1 Document and Media for Saving and Retrieving Images
New Member Beiträge: 10 Beitrittsdatum: 18.04.12 Neueste Beiträge
Hi Hitoshi,
Thanks for your suggestion.
I have done what you said to do.
But it remains same.
Is there any other way to solve this issue ?
Can you see my code I posted here. Is there any wrong on that ?
Thanks in advance
Shamik
Thanks for your suggestion.
I have done what you said to do.
But it remains same.
Is there any other way to solve this issue ?
Can you see my code I posted here. Is there any wrong on that ?
Thanks in advance

Shamik