//如果是图片文件,则执行缩放处理
Path source = Paths.get(newFilePath);
String contentType = Files.probeContentType(source);
if (contentType.startsWith("image")){
String thumbPath = this.getImgAbsolutePath(request, "thumb");
ImageUtils.resize(newFilePath, thumbPath, 94, 222, true);
}原文地址:http://blog.csdn.net/testcs_dn/article/details/39209761