try {
File thumbnailFile = new File(thumbnailsDirectory + file.getName());
if(!thumbnailFile.exists()){
IImage image = new AWTImage(file.getAbsolutePath());
image.scale(125, 125, true, true);
image.saveAs(thumbnailFile.getAbsolutePath());
writer.write("<br>Generated thumbnail: <img src=\"/photos/"+currentDirectory+"/thumbnails/"+file.getName()+"\"/><br/>");
writer.flush();
}
} catch (IOException e) {
thumbsDirFile.delete();