/** * Retrieves an existing thumbnail, or creates a new one. * * @param originalFile The file which is being thumbnailed. * @param thumbnailFile The location of the existing thumbnail (if it exists), or the location to create a new * thumbnail. * @param maxWidth The max width of the thumbnail. * @param maxHeight The max height of the thumbnail. */ public Thumbnail retrieveOrCreateThumbNail(File originalFile, File thumbnailFile, int maxWidth, int maxHeight, long thumbnailId) throws MalformedURLException { FileInputStream originalFileStream = null; try { originalFileStream = new FileInputStream(originalFile); return retrieveOrCreateThumbNail(originalFileStream, originalFile.getName(), thumbnailFile, maxWidth, maxHeight, thumbnailId); } catch (FileNotFoundException e) { log.error("Unable to create thumbnail: file not found: " + originalFile.getAbsolutePath()); } finally { IOUtils.closeQuietly(originalFileStream); } return null; }
return retrieveOrCreateThumbNail(originalFileStream, originalFile.getName(), thumbnailFile, maxWidth, maxHeight, thumbnailId);