Forums de discussion

Thumbnails

Sameer Shaik, modifié il y a 11 années.

Thumbnails

New Member Publications: 19 Date d'inscription: 02/08/12 Publications récentes
How to convert an image into a thumbnail in liferay ?
thumbnail
Tejas Kanani, modifié il y a 11 années.

RE: Thumbnails

Liferay Master Publications: 654 Date d'inscription: 06/01/09 Publications récentes
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, modifié il y a 11 années.

RE: Thumbnails

New Member Publications: 19 Date d'inscription: 02/08/12 Publications récentes
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, modifié il y a 11 années.

RE: Thumbnails

Liferay Master Publications: 654 Date d'inscription: 06/01/09 Publications récentes
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, modifié il y a 11 années.

RE: Thumbnails

New Member Publications: 19 Date d'inscription: 02/08/12 Publications récentes
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.

Pièces jointes:

thumbnail
Tejas Kanani, modifié il y a 11 années.

RE: Thumbnails

Liferay Master Publications: 654 Date d'inscription: 06/01/09 Publications récentes
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, modifié il y a 11 années.

RE: Thumbnails

New Member Publications: 19 Date d'inscription: 02/08/12 Publications récentes
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, modifié il y a 11 années.

RE: Thumbnails

Liferay Master Publications: 654 Date d'inscription: 06/01/09 Publications récentes
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, modifié il y a 11 années.

RE: Thumbnails

New Member Publications: 19 Date d'inscription: 02/08/12 Publications récentes
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, modifié il y a 8 années.

RE: Thumbnails

New Member Envoyer: 1 Date d'inscription: 12/08/15 Publications récentes
Im facing the same issue plz reply
thumbnail
Alberto Chaparro, modifié il y a 8 années.

RE: Thumbnails

Liferay Master Publications: 549 Date d'inscription: 25/04/11 Publications récentes
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, modifié il y a 11 années.

RE: Thumbnails

Liferay Legend Publications: 7942 Date d'inscription: 24/03/10 Publications récentes
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, modifié il y a 11 années.

RE: Thumbnails

New Member Publications: 19 Date d'inscription: 02/08/12 Publications récentes
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, modifié il y a 11 années.

RE: Thumbnails

Liferay Legend Publications: 7942 Date d'inscription: 24/03/10 Publications récentes
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, modifié il y a 11 années.

RE: Thumbnails

New Member Publications: 19 Date d'inscription: 02/08/12 Publications récentes
hi Hitoshi,

Yeah image is present in Document & media only,pls see the screen shot which i have posted now...
thumbnail
Vijay Gohil, modifié il y a 11 années.

RE: Thumbnails

New Member Publications: 16 Date d'inscription: 29/06/10 Publications récentes
Hi Sameer,

Please try below method which creates thumbnail image from normal image

IGImage igImage = IGImageLocalServiceUtil.getImageByUuidAndGroupId(uuId, groupId);
Sameer Shaik, modifié il y a 11 années.

RE: Thumbnails

New Member Publications: 19 Date d'inscription: 02/08/12 Publications récentes
hi vijay,

"IGImageLocalServiceUtil" is not working in liferay 6.1