diff options
Diffstat (limited to 'juick-server-web/src/main/java/com/juick/server/util')
-rw-r--r-- | juick-server-web/src/main/java/com/juick/server/util/ImageUtils.java | 14 |
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 |