掲示板
Thumbnails
How to convert an image into a thumbnail in liferay ?
Hi Sameer,
Not sure this will help you or not. But in Liferay if your image uploaded in Documents & Media portlet and lets say its url is
And if you want its thumbnail image then you can use below url
Only difference in second url is imageThumbnail=1 parameter.
So you can add imageThumbnail=1 to display thumbnail of your image(If its uploaded in Documents & Media portlet).
Not sure this will help you or not. But in Liferay if your image uploaded in Documents & Media portlet and lets say its url is
http://localhost:8080/documents/10703/0/Tejas/0fb48caa-7be4-48bf-a2cd-38dc23ef6a79?version=1.0&t=1344161777109
And if you want its thumbnail image then you can use below url
http://localhost:8080/documents/10703/0/Tejas/0fb48caa-7be4-48bf-a2cd-38dc23ef6a79?version=1.0&t=1344161777109&imageThumbnail=1
Only difference in second url is imageThumbnail=1 parameter.
So you can add imageThumbnail=1 to display thumbnail of your image(If its uploaded in Documents & Media portlet).
Hi Tejas,
Thanks for your reply..
I have tried your code but still i am unable to get the thumbnail,and moreover my images are present in document library,and i am using liferay 6.1.
Thanks for your reply..
I have tried your code but still i am unable to get the thumbnail,and moreover my images are present in document library,and i am using liferay 6.1.
You can check the same in Document & Media portlet thumbnail view only.
Just go to Control Panel --> Documents & Media --> Your Image in folder view
Here you'll find all your image's thumbnails. And if you check its url using Firebug or in html source.
You'll find similar url which I've suggested. So you can take reference of this. And please also find attached snap.
So verify if you are getting your uploaded image's thumbnail in Documents & Media portlet ? If yes then it take its url and it will work for you anywhere.
Just go to Control Panel --> Documents & Media --> Your Image in folder view
Here you'll find all your image's thumbnails. And if you check its url using Firebug or in html source.
You'll find similar url which I've suggested. So you can take reference of this. And please also find attached snap.
So verify if you are getting your uploaded image's thumbnail in Documents & Media portlet ? If yes then it take its url and it will work for you anywhere.
hi Tejas
Thanks for the reply..
I am able to display thumbnail but ,image is not getting displayed inside thumbnail..pls check the following screenshot once..i have rounded the thumbnail part with red circle..pls check it.
Thanks for the reply..
I am able to display thumbnail but ,image is not getting displayed inside thumbnail..pls check the following screenshot once..i have rounded the thumbnail part with red circle..pls check it.
添付ファイル:
What is the url for your thumbnail ?
Check whether are you getting the thumbnail for same image in Documents & Media portlet.
If yes, compare the url of yours and Document & Media portlet's.
Check whether are you getting the thumbnail for same image in Documents & Media portlet.
If yes, compare the url of yours and Document & Media portlet's.
Hi tejas
I have uploaded an image directly into Document & media like(Add >Basic Document) and in this way i am able to get the thumbnail,but actually my requirement is i need to
insert image through an action class into document library,and i have inserted through an action class also,but i am unable to get the thumbnail in this way moreover my image is getting stored like this,see the following screenshot,
I have uploaded an image directly into Document & media like(Add >Basic Document) and in this way i am able to get the thumbnail,but actually my requirement is i need to
insert image through an action class into document library,and i have inserted through an action class also,but i am unable to get the thumbnail in this way moreover my image is getting stored like this,see the following screenshot,
Hi Sameer,
Can you please share the code which you've wrote using Liferay API to store the image in Documents & Media ? Looks like its not even displaying thumbnail in Document & Media portlet.
Can you please share the code which you've wrote using Liferay API to store the image in Documents & Media ? Looks like its not even displaying thumbnail in Document & Media portlet.
hi tejas,
public void uploadImage(ActionRequest actionRequest,
ActionResponse actionResponse,File file) throws Exception {
ThemeDisplay themeDisplay = (ThemeDisplay) actionRequest
.getAttribute("THEME_DISPLAY");
String folderName = "UPLOADED_IMAGES";
long groupId = themeDisplay.getScopeGroupId();;
long userId = themeDisplay.getUserId();
long companyId = themeDisplay.getCompanyId();
UploadPortletRequest uploadPortletRequest = PortalUtil
.getUploadPortletRequest(actionRequest);
System.out.println("from uploaded"+file);
InputStream inputStream = uploadPortletRequest.getFileAsStream("addimage");
String fileName =FileUtil.getShortFileName(file.getName());
String as=themeDisplay.getPathContext();
System.out.println("from uploaded images"+ fileName);
System.out.println(as);
String contentType = uploadPortletRequest.getContentType();
long folderId = 0l;
long repositoryId = DLFolderConstants.getDataRepositoryId(themeDisplay.getScopeGroupId(),DLFolderConstants.DEFAULT_PARENT_FOLDER_ID);
ServiceContext serviceContext = new ServiceContext();
serviceContext.setAddGroupPermissions(true);
serviceContext.setAddGuestPermissions(true);
serviceContext.setScopeGroupId(groupId);
serviceContext.setCompanyId(companyId);
DLFolder dlFolder = null;
try {
dlFolder = DLFolderLocalServiceUtil.getFolder(groupId,DLFolderConstants.DEFAULT_PARENT_FOLDER_ID, folderName);
} catch (Exception dde) {
dlFolder = DLFolderLocalServiceUtil.addFolder(userId, groupId,
repositoryId, false, 0l, folderName, folderName,
serviceContext);
}
DLAppLocalServiceUtil.addFileEntry(userId, repositoryId, folderId,
fileName, contentType, fileName, fileName, null, file,
serviceContext);
}
public void uploadImage(ActionRequest actionRequest,
ActionResponse actionResponse,File file) throws Exception {
ThemeDisplay themeDisplay = (ThemeDisplay) actionRequest
.getAttribute("THEME_DISPLAY");
String folderName = "UPLOADED_IMAGES";
long groupId = themeDisplay.getScopeGroupId();;
long userId = themeDisplay.getUserId();
long companyId = themeDisplay.getCompanyId();
UploadPortletRequest uploadPortletRequest = PortalUtil
.getUploadPortletRequest(actionRequest);
System.out.println("from uploaded"+file);
InputStream inputStream = uploadPortletRequest.getFileAsStream("addimage");
String fileName =FileUtil.getShortFileName(file.getName());
String as=themeDisplay.getPathContext();
System.out.println("from uploaded images"+ fileName);
System.out.println(as);
String contentType = uploadPortletRequest.getContentType();
long folderId = 0l;
long repositoryId = DLFolderConstants.getDataRepositoryId(themeDisplay.getScopeGroupId(),DLFolderConstants.DEFAULT_PARENT_FOLDER_ID);
ServiceContext serviceContext = new ServiceContext();
serviceContext.setAddGroupPermissions(true);
serviceContext.setAddGuestPermissions(true);
serviceContext.setScopeGroupId(groupId);
serviceContext.setCompanyId(companyId);
DLFolder dlFolder = null;
try {
dlFolder = DLFolderLocalServiceUtil.getFolder(groupId,DLFolderConstants.DEFAULT_PARENT_FOLDER_ID, folderName);
} catch (Exception dde) {
dlFolder = DLFolderLocalServiceUtil.addFolder(userId, groupId,
repositoryId, false, 0l, folderName, folderName,
serviceContext);
}
DLAppLocalServiceUtil.addFileEntry(userId, repositoryId, folderId,
fileName, contentType, fileName, fileName, null, file,
serviceContext);
}
Im facing the same issue plz reply
Just open up your document and media portlet and select "URL" link. Copy the URL that shows up and just append "&imageThumbnail=1" to the end of the url.
Open a web browser and paste the url with the &imageThumbnail=1 appended. It should show the image as a thumbnail.
Open a web browser and paste the url with the &imageThumbnail=1 appended. It should show the image as a thumbnail.
hi hitoshi
Thanks for the reply...
pls check the screen shot which i have posted in this page because i am able to get the thumbnail,but image is not getting displayed .
Thanks for the reply...
pls check the screen shot which i have posted in this page because i am able to get the thumbnail,but image is not getting displayed .