public Point getImageSize(Node node) throws RepositoryException {
// TODO optimise
Image image = getSwtImage(node);
- return new Point(image.getBounds().width,image.getBounds().height);
+ return new Point(image.getBounds().width, image.getBounds().height);
}
/** @return null if not available */
}
@Override
- public String uploadImage(Node parentNode, String fileName, InputStream in) throws RepositoryException {
+ public String uploadImage(Node parentNode, String fileName, InputStream in, String contentType)
+ throws RepositoryException {
InputStream inputStream = null;
try {
String previousResourceName = null;
ImageData id = new ImageData(inputStream);
processNewImageFile(fileNode, id);
- String mime = Files.probeContentType(Paths.get(fileName));
- fileNode.setProperty(Property.JCR_MIMETYPE, mime);
+ String mime = contentType != null ? contentType : Files.probeContentType(Paths.get(fileName));
+ if (mime != null)
+ fileNode.setProperty(Property.JCR_MIMETYPE, mime);
fileNode.getSession().save();
// reset resource manager
}
}
- /** Does nothign by default. */
+ /** Does nothing by default. */
protected void processNewImageFile(Node fileNode, ImageData id) throws RepositoryException, IOException {
}
}