]> gitweb.fperrin.net Git - GpsPrune.git/blobdiff - tim/prune/gui/PhotoThumbnail.java
Version 19, May 2018
[GpsPrune.git] / tim / prune / gui / PhotoThumbnail.java
index 686d90a1ac1eff972a0b20380e40e2cf03c05ea9..458ee8d84d866945d92d4cf51fb2b1da83ee5cd4 100644 (file)
@@ -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();