mirror of
https://github.com/overcuriousity/autopsy-flatpak.git
synced 2025-07-15 09:17:42 +00:00
fix animated gif loading; add "undisplayable" icon to DrawableTile.fxml
This commit is contained in:
parent
47d6318ecd
commit
798ce18f0b
@ -18,13 +18,11 @@
|
|||||||
*/
|
*/
|
||||||
package org.sleuthkit.autopsy.imagegallery.datamodel;
|
package org.sleuthkit.autopsy.imagegallery.datamodel;
|
||||||
|
|
||||||
import java.awt.image.BufferedImage;
|
import java.io.BufferedInputStream;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.lang.ref.SoftReference;
|
import java.lang.ref.SoftReference;
|
||||||
import java.util.logging.Level;
|
import java.util.logging.Level;
|
||||||
import javafx.embed.swing.SwingFXUtils;
|
|
||||||
import javafx.scene.image.Image;
|
import javafx.scene.image.Image;
|
||||||
import javax.imageio.ImageIO;
|
|
||||||
import org.sleuthkit.autopsy.coreutils.Logger;
|
import org.sleuthkit.autopsy.coreutils.Logger;
|
||||||
import org.sleuthkit.autopsy.imagegallery.ThumbnailCache;
|
import org.sleuthkit.autopsy.imagegallery.ThumbnailCache;
|
||||||
import org.sleuthkit.datamodel.AbstractFile;
|
import org.sleuthkit.datamodel.AbstractFile;
|
||||||
@ -51,23 +49,33 @@ public class ImageFile<T extends AbstractFile> extends DrawableFile<T> {
|
|||||||
return ThumbnailCache.getDefault().get(this);
|
return ThumbnailCache.getDefault().get(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public Image getFullSizeImage() {
|
public Image getFullSizeImage() {
|
||||||
Image image = null;
|
Image image = null;
|
||||||
if (imageRef != null) {
|
if (imageRef != null) {
|
||||||
image = imageRef.get();
|
image = imageRef.get();
|
||||||
}
|
}
|
||||||
if (image == null) {
|
|
||||||
|
|
||||||
try (ReadContentInputStream readContentInputStream = new ReadContentInputStream(this.getAbstractFile())) {
|
if (image == null) {
|
||||||
BufferedImage read = ImageIO.read(readContentInputStream);
|
try (BufferedInputStream readContentInputStream = new BufferedInputStream(new ReadContentInputStream(this.getAbstractFile()))) {
|
||||||
image = SwingFXUtils.toFXImage(read, null);
|
image = new Image(readContentInputStream);
|
||||||
} catch (IOException | NullPointerException ex) {
|
if (image.errorProperty().get()) {
|
||||||
|
image.getException().printStackTrace();
|
||||||
|
}
|
||||||
|
} catch (IOException ex) {
|
||||||
Logger.getLogger(ImageFile.class.getName()).log(Level.WARNING, "unable to read file" + getName());
|
Logger.getLogger(ImageFile.class.getName()).log(Level.WARNING, "unable to read file" + getName());
|
||||||
return null;
|
|
||||||
}
|
}
|
||||||
imageRef = new SoftReference<>(image);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// if (image == null || image.isError()) {
|
||||||
|
// try (ReadContentInputStream readContentInputStream = new ReadContentInputStream(this.getAbstractFile())) {
|
||||||
|
// BufferedImage read = ImageIO.read(readContentInputStream);
|
||||||
|
// image = SwingFXUtils.toFXImage(read, null);
|
||||||
|
// } catch (IOException | NullPointerException ex) {
|
||||||
|
// Logger.getLogger(ImageFile.class.getName()).log(Level.WARNING, "unable to read file" + getName());
|
||||||
|
// return null;
|
||||||
|
// }
|
||||||
|
// imageRef = new SoftReference<>(image);
|
||||||
|
// }
|
||||||
return image;
|
return image;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -34,6 +34,11 @@
|
|||||||
<Insets bottom="1.0" left="1.0" right="1.0" top="1.0" fx:id="x1" />
|
<Insets bottom="1.0" left="1.0" right="1.0" top="1.0" fx:id="x1" />
|
||||||
</HBox.margin>
|
</HBox.margin>
|
||||||
</ImageView>
|
</ImageView>
|
||||||
|
<ImageView fx:id="undisplayableImageView" fitHeight="16.0" fitWidth="16.0" pickOnBounds="true" preserveRatio="true">
|
||||||
|
<image>
|
||||||
|
<Image url="@../../images/prohibition.png" />
|
||||||
|
</image>
|
||||||
|
</ImageView>
|
||||||
</children>
|
</children>
|
||||||
<padding>
|
<padding>
|
||||||
<Insets bottom="2.0" right="2.0" top="2.0" />
|
<Insets bottom="2.0" right="2.0" top="2.0" />
|
||||||
|
Loading…
x
Reference in New Issue
Block a user