X-Git-Url: http://www2.svjatoslav.eu/gitweb/?a=blobdiff_plain;f=src%2Fmain%2Fjava%2Feu%2Fsvjatoslav%2Fmeviz%2Fhtmlindexer%2Fmetadata%2FfileTypes%2FPicture.java;h=9f357437eb372b230e94b8f2a7b0f7da374d9f37;hb=4e5e467eaf6e4edda1dd5707e5402065c7509c79;hp=4c3aee7da1bbc4feaaa140d6b2a5eeba0e25bed2;hpb=891ecca562e87bb5d0ab1e49eea566c15fe91c6d;p=meviz.git diff --git a/src/main/java/eu/svjatoslav/meviz/htmlindexer/metadata/fileTypes/Picture.java b/src/main/java/eu/svjatoslav/meviz/htmlindexer/metadata/fileTypes/Picture.java index 4c3aee7..9f35743 100755 --- a/src/main/java/eu/svjatoslav/meviz/htmlindexer/metadata/fileTypes/Picture.java +++ b/src/main/java/eu/svjatoslav/meviz/htmlindexer/metadata/fileTypes/Picture.java @@ -1,11 +1,11 @@ /* * Meviz - Various tools collection to work with multimedia. - * Copyright (C) 2012, Svjatoslav Agejenko, svjatoslav@svjatoslav.eu + * Copyright (C) 2012 -- 2019, Svjatoslav Agejenko, svjatoslav@svjatoslav.eu * * This program is free software; you can redistribute it and/or - * modify it under the terms of version 2 of the GNU General Public License - * as published by the Free Software Foundation. - */ + * modify it under the terms of version 3 of the GNU Lesser General Public License + * or later as published by the Free Software Foundation. +*/ package eu.svjatoslav.meviz.htmlindexer.metadata.fileTypes; @@ -27,6 +27,9 @@ import java.io.OutputStream; import java.util.ArrayList; import java.util.List; +import static eu.svjatoslav.meviz.htmlindexer.Utils.getBufferedImage; +import static java.awt.image.BufferedImage.TYPE_INT_RGB; + public class Picture extends AbstractFile { private static final long serialVersionUID = -4156533490858298387L; @@ -105,7 +108,7 @@ public class Picture extends AbstractFile { try { - final BufferedImage inputImage = Utils.getBufferedImage(inputFile); + final BufferedImage inputImage = getBufferedImage(inputFile); final java.awt.Dimension sourceImageDimension = new java.awt.Dimension( inputImage.getWidth(), inputImage.getHeight()); @@ -120,7 +123,7 @@ public class Picture extends AbstractFile { final BufferedImage bufferedImage = new BufferedImage( scaledImage.getWidth(null), scaledImage.getHeight(null), - BufferedImage.TYPE_INT_RGB); + TYPE_INT_RGB); final Graphics2D g = bufferedImage.createGraphics(); g.drawImage(scaledImage, 0, 0, null); @@ -156,9 +159,9 @@ public class Picture extends AbstractFile { // compute new thumbnails hash number final String forMagicHash = fileName + " " - + String.valueOf(targetDimension.width) + " " - + String.valueOf(targetDimension.height) + " " - + String.valueOf(getFileLength()) + " " + + targetDimension.width + " " + + targetDimension.height + " " + + getFileLength() + " " + Constants.THUMBNAIL_VERSION; // System.out.println("Computing hash from: " + forMagicHash); @@ -175,13 +178,12 @@ public class Picture extends AbstractFile { */ public String getRelativeThumbnailFileName(final Dimension targetDimension) { return FilePathParser.getFileNameWithoutExtension(fileName) + " (" - + computeThumbnailHash(targetDimension) + ").jpeg"; + + computeThumbnailHash(targetDimension) + ")." + getFileExtension(); } @Override - public void updateFileMetainfo(final File parentDirectory) throws Exception { - final BufferedImage image = Utils - .getBufferedImage(getFile(parentDirectory)); + public void updateFileMetadata(final File parentDirectory) throws Exception { + final BufferedImage image = getBufferedImage(getFile(parentDirectory)); dimensions = new Dimension(image.getWidth(), image.getHeight()); }