List of usage examples for com.liferay.portal.kernel.util PropsKeys DL_FILE_ENTRY_THUMBNAIL_CUSTOM_1_MAX_WIDTH
String DL_FILE_ENTRY_THUMBNAIL_CUSTOM_1_MAX_WIDTH
To view the source code for com.liferay.portal.kernel.util PropsKeys DL_FILE_ENTRY_THUMBNAIL_CUSTOM_1_MAX_WIDTH.
Click Source Link
From source file:com.liferay.adaptive.media.document.library.thumbnails.internal.osgi.commands.AMThumbnailsOSGiCommands.java
License:Open Source License
private ThumbnailConfiguration[] _getThumbnailConfigurations() { return new ThumbnailConfiguration[] { new ThumbnailConfiguration(PrefsPropsUtil.getInteger(PropsKeys.DL_FILE_ENTRY_THUMBNAIL_MAX_WIDTH), PrefsPropsUtil.getInteger(PropsKeys.DL_FILE_ENTRY_THUMBNAIL_MAX_HEIGHT), Pattern.compile( DLPreviewableProcessor.THUMBNAIL_PATH + "\\d+/\\d+(?:/\\d+)+/(\\d+)(?:\\..+)?$")), new ThumbnailConfiguration( PrefsPropsUtil.getInteger(PropsKeys.DL_FILE_ENTRY_THUMBNAIL_CUSTOM_1_MAX_WIDTH), PrefsPropsUtil.getInteger(PropsKeys.DL_FILE_ENTRY_THUMBNAIL_CUSTOM_1_MAX_HEIGHT), Pattern.compile( DLPreviewableProcessor.THUMBNAIL_PATH + "\\d+/\\d+(?:/\\d+)+/(\\d+)-1(?:\\..+)?$")), new ThumbnailConfiguration( PrefsPropsUtil.getInteger(PropsKeys.DL_FILE_ENTRY_THUMBNAIL_CUSTOM_2_MAX_WIDTH), PrefsPropsUtil.getInteger(PropsKeys.DL_FILE_ENTRY_THUMBNAIL_CUSTOM_2_MAX_HEIGHT), Pattern.compile(DLPreviewableProcessor.THUMBNAIL_PATH + "\\d+/\\d+(?:/\\d+)+/(\\d+)-2(?:\\..+)?$")) }; }
From source file:com.liferay.adaptive.media.document.library.thumbnails.internal.util.AMCompanyThumbnailConfigurationInitializer.java
License:Open Source License
public void initializeCompany(Company company) throws AMImageConfigurationException, IOException { int dlFileEntryThumbnailMaxHeight = PrefsPropsUtil.getInteger(PropsKeys.DL_FILE_ENTRY_THUMBNAIL_MAX_HEIGHT); int dlFileEntryThumbnailMaxWidth = PrefsPropsUtil.getInteger(PropsKeys.DL_FILE_ENTRY_THUMBNAIL_MAX_WIDTH); if ((dlFileEntryThumbnailMaxHeight > 0) && (dlFileEntryThumbnailMaxWidth > 0)) { _createAMDocumentLibraryThumbnailConfiguration(company, dlFileEntryThumbnailMaxHeight, dlFileEntryThumbnailMaxWidth); }//from ww w . ja v a 2 s.c o m int dlFileEntryThumbnailCustom1MaxHeight = PrefsPropsUtil .getInteger(PropsKeys.DL_FILE_ENTRY_THUMBNAIL_CUSTOM_1_MAX_HEIGHT); int dlFileEntryThumbnailCustom1MaxWidth = PrefsPropsUtil .getInteger(PropsKeys.DL_FILE_ENTRY_THUMBNAIL_CUSTOM_1_MAX_WIDTH); if ((dlFileEntryThumbnailCustom1MaxHeight > 0) && (dlFileEntryThumbnailCustom1MaxWidth > 0)) { _createAMDocumentLibraryThumbnailConfiguration(company, dlFileEntryThumbnailCustom1MaxHeight, dlFileEntryThumbnailCustom1MaxWidth); } int dlFileEntryThumbnailCustom2MaxHeight = PrefsPropsUtil .getInteger(PropsKeys.DL_FILE_ENTRY_THUMBNAIL_CUSTOM_2_MAX_HEIGHT); int dlFileEntryThumbnailCustom2MaxWidth = PrefsPropsUtil .getInteger(PropsKeys.DL_FILE_ENTRY_THUMBNAIL_CUSTOM_2_MAX_WIDTH); if ((dlFileEntryThumbnailCustom2MaxHeight > 0) && (dlFileEntryThumbnailCustom2MaxWidth > 0)) { _createAMDocumentLibraryThumbnailConfiguration(company, dlFileEntryThumbnailCustom2MaxHeight, dlFileEntryThumbnailCustom2MaxWidth); } }
From source file:com.liferay.portlet.documentlibrary.util.DLPreviewableProcessor.java
License:Open Source License
protected boolean isThumbnailEnabled(int index) throws SystemException { if ((index == THUMBNAIL_INDEX_DEFAULT) && GetterUtil.getBoolean(PropsUtil.get(PropsKeys.DL_FILE_ENTRY_THUMBNAIL_ENABLED))) { return true; } else if ((index == THUMBNAIL_INDEX_CUSTOM_1) && ((PrefsPropsUtil.getInteger(PropsKeys.DL_FILE_ENTRY_THUMBNAIL_CUSTOM_1_MAX_HEIGHT) > 0) || (PrefsPropsUtil.getInteger(PropsKeys.DL_FILE_ENTRY_THUMBNAIL_CUSTOM_1_MAX_WIDTH) > 0))) { return true; } else if ((index == THUMBNAIL_INDEX_CUSTOM_2) && ((PrefsPropsUtil.getInteger(PropsKeys.DL_FILE_ENTRY_THUMBNAIL_CUSTOM_2_MAX_HEIGHT) > 0) || (PrefsPropsUtil.getInteger(PropsKeys.DL_FILE_ENTRY_THUMBNAIL_CUSTOM_2_MAX_WIDTH) > 0))) { return true; }//from w ww. j a va 2s . co m return false; }
From source file:com.liferay.portlet.documentlibrary.util.DLPreviewableProcessor.java
License:Open Source License
protected void storeThumbnailImage(FileVersion fileVersion, RenderedImage renderedImage, int index) throws Exception { if (!isThumbnailEnabled(index) || hasThumbnail(fileVersion, index)) { return;//from ww w. j a va 2 s.c o m } String type = getThumbnailType(fileVersion); String maxHeightPropsKey = PropsKeys.DL_FILE_ENTRY_THUMBNAIL_MAX_HEIGHT; String maxWidthPropsKey = PropsKeys.DL_FILE_ENTRY_THUMBNAIL_MAX_WIDTH; if (index == THUMBNAIL_INDEX_CUSTOM_1) { maxHeightPropsKey = PropsKeys.DL_FILE_ENTRY_THUMBNAIL_CUSTOM_1_MAX_HEIGHT; maxWidthPropsKey = PropsKeys.DL_FILE_ENTRY_THUMBNAIL_CUSTOM_1_MAX_WIDTH; } else if (index == THUMBNAIL_INDEX_CUSTOM_2) { maxHeightPropsKey = PropsKeys.DL_FILE_ENTRY_THUMBNAIL_CUSTOM_2_MAX_HEIGHT; maxWidthPropsKey = PropsKeys.DL_FILE_ENTRY_THUMBNAIL_CUSTOM_2_MAX_WIDTH; } RenderedImage thumbnailRenderedImage = ImageToolUtil.scale(renderedImage, PrefsPropsUtil.getInteger(maxHeightPropsKey), PrefsPropsUtil.getInteger(maxWidthPropsKey)); byte[] bytes = ImageToolUtil.getBytes(thumbnailRenderedImage, type); File file = null; try { file = FileUtil.createTempFile(bytes); addFileToStore(fileVersion.getCompanyId(), THUMBNAIL_PATH, getThumbnailFilePath(fileVersion, type, index), file); } finally { FileUtil.delete(file); } }