X-Git-Url: https://gitweb.fperrin.net/?a=blobdiff_plain;f=tim%2Fprune%2Fgui%2FPhotoThumbnail.java;h=458ee8d84d866945d92d4cf51fb2b1da83ee5cd4;hb=92dad5df664287acb51728e9ea599f150765d34a;hp=686d90a1ac1eff972a0b20380e40e2cf03c05ea9;hpb=f35b6d628f68e3b5ef19965ad8988d0dd1eb8efa;p=GpsPrune.git diff --git a/tim/prune/gui/PhotoThumbnail.java b/tim/prune/gui/PhotoThumbnail.java index 686d90a..458ee8d 100644 --- a/tim/prune/gui/PhotoThumbnail.java +++ b/tim/prune/gui/PhotoThumbnail.java @@ -129,14 +129,16 @@ public class PhotoThumbnail extends JPanel implements Runnable { if (_inPanel) { - // use either exif thumbnail or photo scaled down to sensible size + _thumbnail = null; + // try to use exif thumbnail if (_photo.getExifThumbnail() != null) { // Use exif thumbnail Image image = new ImageIcon(_photo.getExifThumbnail()).getImage(); _thumbnail = ImageUtils.createScaledImage(image, image.getWidth(null), image.getHeight(null)); image = null; } - else + // Maybe there's no thumbnail, maybe the load of the thumbnail failed + if (_thumbnail == null) { // no exif thumbnail available, going to have to read whole thing int picWidth = _photo.getWidth(); @@ -148,7 +150,7 @@ public class PhotoThumbnail extends JPanel implements Runnable // calculate maximum thumbnail size Dimension thumbSize = ImageUtils.getThumbnailSize(picWidth, picHeight, DEFAULT_THUMB_SIZE, DEFAULT_THUMB_SIZE); // Make icon to load image into - Image image = new ImageIcon(_photo.getFile().getAbsolutePath()).getImage(); + Image image = _photo.createImageIcon().getImage(); // save scaled, smoothed thumbnail for reuse _thumbnail = ImageUtils.createScaledImage(image, thumbSize.width, thumbSize.height); image = null; @@ -157,7 +159,7 @@ public class PhotoThumbnail extends JPanel implements Runnable } } else { - _thumbnail = new ImageIcon(_photo.getFile().getAbsolutePath()).getImage(); + _thumbnail = _photo.createImageIcon().getImage(); } _loadingImage = false; repaint();