aboutsummaryrefslogtreecommitdiff
path: root/juick-server-web/src/main
diff options
context:
space:
mode:
authorGravatar Vitaly Takmazov2017-12-08 10:50:03 +0300
committerGravatar Vitaly Takmazov2017-12-08 10:50:03 +0300
commitdd8f40e446f58128dfcfde24539c46b7490ebc39 (patch)
tree66773ed6fdbad072decf27c2cc3a47d2d4521e9d /juick-server-web/src/main
parentc15afc93abd1be072a20b9540f065b939b4e0a22 (diff)
web: do not try to get metadata from non-existing images
Diffstat (limited to 'juick-server-web/src/main')
-rw-r--r--juick-server-web/src/main/java/com/juick/server/util/ImageUtils.java14
1 files changed, 10 insertions, 4 deletions
diff --git a/juick-server-web/src/main/java/com/juick/server/util/ImageUtils.java b/juick-server-web/src/main/java/com/juick/server/util/ImageUtils.java
index 4403abc0..94ecf71e 100644
--- a/juick-server-web/src/main/java/com/juick/server/util/ImageUtils.java
+++ b/juick-server-web/src/main/java/com/juick/server/util/ImageUtils.java
@@ -152,11 +152,17 @@ public class ImageUtils {
}
public static Integer getImageHeight(File imageFile) throws IOException, ImageReadException {
- ImageInfo info = Imaging.getImageInfo(imageFile);
- return info.getHeight();
+ if (imageFile.exists()) {
+ ImageInfo info = Imaging.getImageInfo(imageFile);
+ return info.getHeight();
+ }
+ return 0;
}
public static Integer getImageWidth(File imageFile) throws IOException, ImageReadException {
- ImageInfo info = Imaging.getImageInfo(imageFile);
- return info.getWidth();
+ if (imageFile.exists()) {
+ ImageInfo info = Imaging.getImageInfo(imageFile);
+ return info.getWidth();
+ }
+ return 0;
}
} \ No newline at end of file