留言板

Thumbnails

Sameer Shaik,修改在11 年前。

Thumbnails

New Member 帖子: 19 加入日期: 12-8-2 最近的帖子
How to convert an image into a thumbnail in liferay ?
thumbnail
Tejas Kanani,修改在11 年前。

RE: Thumbnails

Liferay Master 帖子: 654 加入日期: 09-1-6 最近的帖子
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
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).
Sameer Shaik,修改在11 年前。

RE: Thumbnails

New Member 帖子: 19 加入日期: 12-8-2 最近的帖子
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.
thumbnail
Tejas Kanani,修改在11 年前。

RE: Thumbnails

Liferay Master 帖子: 654 加入日期: 09-1-6 最近的帖子
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.
Sameer Shaik,修改在11 年前。

RE: Thumbnails

New Member 帖子: 19 加入日期: 12-8-2 最近的帖子
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.
thumbnail
Tejas Kanani,修改在11 年前。

RE: Thumbnails

Liferay Master 帖子: 654 加入日期: 09-1-6 最近的帖子
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.
Sameer Shaik,修改在11 年前。

RE: Thumbnails

New Member 帖子: 19 加入日期: 12-8-2 最近的帖子
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,
thumbnail
Tejas Kanani,修改在11 年前。

RE: Thumbnails

Liferay Master 帖子: 654 加入日期: 09-1-6 最近的帖子
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.
Sameer Shaik,修改在11 年前。

RE: Thumbnails

New Member 帖子: 19 加入日期: 12-8-2 最近的帖子
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);


}
santhosh mp,修改在8 年前。

RE: Thumbnails

New Member 发布: 1 加入日期: 15-8-12 最近的帖子
Im facing the same issue plz reply
thumbnail
Alberto Chaparro,修改在8 年前。

RE: Thumbnails

Liferay Master 帖子: 549 加入日期: 11-4-25 最近的帖子
Hi Sammer,

If your purpose is to generate thumbnails programmatically you can use the following method:
com.liferay.portlet.documentlibrary.util.ImageProcessorUtil.generateImages(null, FileVersion destinationFileVersion)


If not, please describe better your problem.

Regards.
thumbnail
Hitoshi Ozawa,修改在11 年前。

RE: Thumbnails

Liferay Legend 帖子: 7942 加入日期: 10-3-24 最近的帖子
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.
Sameer Shaik,修改在11 年前。

RE: Thumbnails

New Member 帖子: 19 加入日期: 12-8-2 最近的帖子
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 .
thumbnail
Hitoshi Ozawa,修改在11 年前。

RE: Thumbnails

Liferay Legend 帖子: 7942 加入日期: 10-3-24 最近的帖子
So your problem is not being able to show thumbnails but that you can not display image.
Is the image in the Document & Media folder? If not, where is the image file?
Sameer Shaik,修改在11 年前。

RE: Thumbnails

New Member 帖子: 19 加入日期: 12-8-2 最近的帖子
hi Hitoshi,

Yeah image is present in Document & media only,pls see the screen shot which i have posted now...
thumbnail
Vijay Gohil,修改在11 年前。

RE: Thumbnails

New Member 帖子: 16 加入日期: 10-6-29 最近的帖子
Hi Sameer,

Please try below method which creates thumbnail image from normal image

IGImage igImage = IGImageLocalServiceUtil.getImageByUuidAndGroupId(uuId, groupId);
Sameer Shaik,修改在11 年前。

RE: Thumbnails

New Member 帖子: 19 加入日期: 12-8-2 最近的帖子
hi vijay,

"IGImageLocalServiceUtil" is not working in liferay 6.1