-
- // yoss: if the config is set so that images should be scaled, make the resized file.
- if (scaleImages){
- logger.info("entered scaleImages");
- ImageProcessor originalProcessor = new ImageMagickImageProcessor(imageFile);
- originalProcessor.descaleImage(maxSize, minDescaleRatio, minDescaleReduction);
- File originalDir = new File(originalFile.getParent());
- if(originalDir!=null && !originalDir.exists()) {
- originalDir.mkdirs();
- }
- if(!originalFile.exists()) {
- logger.debug("the original image file doesn't exist, copying to originalFile");
- StreamCopier.copyFile(imageFile, originalFile);
- }
- // yoss: don't write the scaled data again if it's the same size as
- // the file that's there right now. Image producer runs are 4 times faster this way.
- logger.info("about to write scaled data, byte length: " + originalProcessor.getScaledFileSize());
- if (originalProcessor.getScaledFileSize() != imageFile.length()) {
- originalProcessor.writeScaledData(imageFile, "JPEG");
- }
- anImageEntity.setFieldValue("original_file_path", imageOriginalRelPath);
- anImageEntity.setFieldValue("img_height", new Integer(originalProcessor.getScaledHeight()).toString());
- anImageEntity.setFieldValue("img_width", new Integer(originalProcessor.getScaledWidth()).toString());
-
- originalProcessor.cleanup();
-
+
+ // yoss: if the config is set so that images should be scaled, make the
+ // resized file.
+ if (scaleImages) {
+ logger.info("entered scaleImages");
+ ImageProcessor originalProcessor = new ImageMagickImageProcessor(
+ imageFile);
+ originalProcessor.descaleImage(maxSize, minDescaleRatio,
+ minDescaleReduction);
+ File originalDir = new File(originalFile.getParent());
+ if (originalDir != null && !originalDir.exists()) {
+ originalDir.mkdirs();
+ }
+ if (!originalFile.exists()) {
+ logger.debug("the original image file doesn't exist, copying to originalFile");
+ FileRoutines.copy(imageFile, originalFile);
+ }
+ // yoss: don't write the scaled data again if it's the same size as
+ // the file that's there right now. Image producer runs are 4 times
+ // faster this way.
+ logger.info("about to write scaled data, byte length: "
+ + originalProcessor.getScaledFileSize());
+ if (originalProcessor.getScaledFileSize() != imageFile.length()) {
+ originalProcessor.writeScaledData(imageFile, "JPEG");
+ }
+ anImageEntity.setFieldValue("original_file_path",
+ imageOriginalRelPath);
+ anImageEntity.setFieldValue("img_height", Integer
+ .toString(originalProcessor.getScaledHeight()));
+ anImageEntity.setFieldValue("img_width", Integer
+ .toString(originalProcessor.getScaledWidth()));
+
+ originalProcessor.cleanup();
+