import mir.media.MediaExc;
import mir.media.MediaFailure;
import mir.media.image.ImageProcessor;
-// FIXME: delete this when finished testing ImageMagickImageProcessor
-//import mir.media.image.JAIImageProcessor;
import mir.media.image.ImageMagickImageProcessor;
import mir.misc.StringUtil;
-
/**
- * Image handler that stores images outside of the database. Will be replaced by the new
- * media handling system.
+ * Image handler that stores images outside of the database.
+ *
* @author Zapata
* @version 1.0
*/
String ext = "." + mediaTypeEnt.getFieldValue("name");
String fileBasePath = datePath + anImageEntity.getId();
String filePath = fileBasePath + ext;
- String iconPath = getIconStoragePath() + fileBasePath + ".jpg";
+ String iconPath = getBaseIconStoragePath() + fileBasePath + ".jpg";
String iconStoragePath = configuration.getString("Producer.StorageRoot") + iconPath;
- String imageFilePath = getStoragePath() + File.separator + filePath;
+ String imageFilePath = getBaseStoragePath() + File.separator + filePath;
File imageFile = new File(imageFilePath);
File iconFile = new File(iconStoragePath);
if (!imageFile.exists()) {
- throw new MediaExc("error in MediaHandlerImagesExtern.produce(): " + filePath + " does not exist!");
+ throw new MediaExc("error in MediaHandlerImagesExtern.execute(): " + filePath + " does not exist!");
}
else {
- // FIXME: delete this when finished testing ImageMagickImageProcessor
- // ImageProcessor processor = new JAIImageProcessor(imageFile);
ImageProcessor processor = new ImageMagickImageProcessor(imageFile);
processor.descaleImage(maxIconSize, minDescaleRatio, minDescaleReduction);
}
}
catch(Throwable t) {
- logger.error("MediaHandlerImagesExtern.produce: " + t.toString());
+ logger.error("MediaHandlerImagesExtern.execute: " + t.toString());
t.printStackTrace(logger.asPrintWriter(LoggerWrapper.DEBUG_MESSAGE));
throw new MediaFailure(t.getMessage(), t);
}
return "image/jpeg";
}
- public String getStoragePath()
+ public String getBaseStoragePath()
{
return configuration.getString("Producer.Image.Path");
}
- public String getIconStoragePath()
+ public String getBaseIconStoragePath()
{
return configuration.getString("Producer.Image.IconPath");
}