Source:
protected PictureView computeView(DocumentModel doc, Blob blob, PictureConversion pictureConversion, ImageInfo imageInfo) { String title = pictureConversion.getId(); Map<String, Serializable> pictureViewMap = new HashMap<>(); pictureViewMap.put(PictureView.FIELD_TITLE, title); pictureViewMap.put(PictureView.FIELD_DESCRIPTION, pictureConversion.getDescription()); pictureViewMap.put(PictureView.FIELD_TAG, pictureConversion.getTag()); Point size = new Point(imageInfo.getWidth(), imageInfo.getHeight()); if (pictureConversion.getMaxSize() != null) { size = ImageResizer.scaleToMax(size.x, size.y, pictureConversion.getMaxSize()); } String conversionFormat = getConfigurationValue(CONVERSION_FORMAT, JPEG_CONVERSATION_FORMAT); Blob viewBlob = callPictureConversionChain(doc, blob, pictureConversion, imageInfo, size, conversionFormat); String extension = FilenameUtils.getExtension(viewBlob.getFilename()); if (StringUtils.isEmpty(extension)) { MimetypeRegistry mimetypeRegistry = Framework.getService(MimetypeRegistry.class); List<String> extensions = mimetypeRegistry.getExtensionsFromMimetypeName(viewBlob.getMimeType()); if (extensions != null && !extensions.isEmpty()) { extension = extensions.get(0); } } String viewFilename = String.format("%s_%s.%s", title, FilenameUtils.getBaseName(blob.getFilename()), extension); viewBlob.setFilename(viewFilename); ImageInfo viewBlobImageInfo = getImageInfo(viewBlob); pictureViewMap.put(PictureView.FIELD_FILENAME, viewFilename); pictureViewMap.put(PictureView.FIELD_CONTENT, (Serializable) viewBlob); pictureViewMap.put(PictureView.FIELD_INFO, viewBlobImageInfo); pictureViewMap.put(PictureView.FIELD_WIDTH, viewBlobImageInfo.getWidth()); pictureViewMap.put(PictureView.FIELD_HEIGHT, viewBlobImageInfo.getHeight()); return new PictureViewImpl(pictureViewMap); }

Target:
protected PictureView computeView(DocumentModel doc, Blob blob, PictureConversion pictureConversion, ImageInfo imageInfo) { String title = pictureConversion.getId(); Map<String, Serializable> pictureViewMap = new HashMap<>(); pictureViewMap.put(PictureView.FIELD_TITLE, title); pictureViewMap.put(PictureView.FIELD_DESCRIPTION, pictureConversion.getDescription()); pictureViewMap.put(PictureView.FIELD_TAG, pictureConversion.getTag()); Point size = new Point(imageInfo.getWidth(), imageInfo.getHeight()); if (pictureConversion.getMaxSize() != null) { size = ImageResizer.scaleToMax(size.x, size.y, pictureConversion.getMaxSize()); } String conversionFormat = getConfigurationValue(CONVERSION_FORMAT, JPEG_CONVERSATION_FORMAT); Blob viewBlob = callPictureConversionChain(doc, blob, pictureConversion, imageInfo, size, conversionFormat); String extension = FilenameUtils.getExtension(viewBlob.getFilename()); if (StringUtils.isEmpty(extension)) { MimetypeRegistry mimetypeRegistry = Framework.getService(MimetypeRegistry.class); List<String> extensions = mimetypeRegistry.getExtensionsFromMimetypeName(viewBlob.getMimeType()); if (extensions != null && !extensions.isEmpty()) { extension = extensions.get(0); } } String viewFilename = String.format("%s_%s.%s", title, FilenameUtils.getBaseName(blob.getFilename()), extension); viewBlob.setFilename(viewFilename); ImageInfo viewBlobImageInfo = getImageInfo(viewBlob); pictureViewMap.put(PictureView.FIELD_FILENAME, viewFilename); pictureViewMap.put(PictureView.FIELD_CONTENT, (Serializable) viewBlob); pictureViewMap.put(PictureView.FIELD_INFO, viewBlobImageInfo); if (viewBlobImageInfo != null){ pictureViewMap.put(PictureView.FIELD_WIDTH, viewBlobImageInfo.getWidth()); pictureViewMap.put(PictureView.FIELD_HEIGHT, viewBlobImageInfo.getHeight()); } return new PictureViewImpl(pictureViewMap); }