Integrated haraldk/TwelveMonkeys library to first add TIF image format

support.
pull/18/head
luc 9 years ago
parent e093fb228d
commit d6522fa4a2

@ -1,95 +1,103 @@
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry kind="src" path="source"/>
<classpathentry excluding="api/|env/|processing/domaingraph/applet/|yacy/|api/bookmarks/|api/ymarks/|api/bookmarks/posts/|api/bookmarks/tags/|api/bookmarks/xbel/|solr/|gsa/|solr/collection1/|api/blacklists/" kind="src" path="htroot"/>
<classpathentry excluding="bookmarks/|ymarks/|bookmarks/posts/|bookmarks/tags/|bookmarks/xbel/|blacklists/" kind="src" path="htroot/api"/>
<classpathentry kind="src" path="htroot/env"/>
<classpathentry kind="src" path="htroot/yacy"/>
<classpathentry excluding="posts/|tags/|xbel/" kind="src" path="htroot/api/bookmarks"/>
<classpathentry kind="src" path="htroot/api/ymarks"/>
<classpathentry kind="src" path="htroot/api/bookmarks/posts"/>
<classpathentry kind="src" path="htroot/api/bookmarks/tags"/>
<classpathentry kind="src" path="htroot/api/bookmarks/xbel"/>
<classpathentry kind="src" path="htroot/api/blacklists"/>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
<classpathentry kind="lib" path="lib/commons-logging-1.2.jar"/>
<classpathentry kind="lib" path="lib/J7Zip-modified.jar"/>
<classpathentry kind="lib" path="lib/webcat-0.1-swf.jar"/>
<classpathentry kind="lib" path="lib/commons-jxpath-1.3.jar"/>
<classpathentry kind="lib" path="lib/jsch-0.1.53.jar"/>
<classpathentry kind="lib" path="lib/jakarta-oro-2.0.8.jar"/>
<classpathentry kind="lib" path="lib/apache-mime4j-0.6.jar"/>
<classpathentry kind="lib" path="lib/commons-fileupload-1.3.1.jar"/>
<classpathentry kind="lib" path="lib/json-simple-1.1.1.jar"/>
<classpathentry kind="lib" path="lib/xercesImpl.jar"/>
<classpathentry kind="lib" path="lib/xml-apis.jar"/>
<classpathentry kind="lib" path="lib/commons-compress-1.9.jar"/>
<classpathentry kind="lib" path="lib/commons-lang-2.6.jar"/>
<classpathentry kind="lib" path="lib/jaudiotagger-2.0.4-20111207.115108-15.jar"/>
<classpathentry kind="lib" path="lib/commons-codec-1.10.jar"/>
<classpathentry kind="lib" path="lib/jcl-over-slf4j-1.7.12.jar"/>
<classpathentry kind="lib" path="lib/slf4j-jdk14-1.7.12.jar"/>
<classpathentry kind="lib" path="lib/log4j-over-slf4j-1.7.12.jar"/>
<classpathentry kind="lib" path="lib/httpcore-4.4.1.jar"/>
<classpathentry kind="lib" path="lib/metadata-extractor-2.8.1.jar"/>
<classpathentry kind="lib" path="lib/xmpcore-5.1.2.jar"/>
<classpathentry kind="lib" path="lib/jcifs-1.3.17.jar"/>
<classpathentry kind="lib" path="lib/guava-18.0.jar"/>
<classpathentry kind="lib" path="lib/spatial4j-0.4.1.jar"/>
<classpathentry kind="lib" path="lib/zookeeper-3.4.6.jar"/>
<classpathentry kind="lib" path="lib/org.restlet.jar"/>
<classpathentry kind="lib" path="lib/fontbox-1.8.10.jar"/>
<classpathentry kind="lib" path="lib/jempbox-1.8.10.jar"/>
<classpathentry kind="lib" path="lib/pdfbox-1.8.10.jar"/>
<classpathentry kind="lib" path="lib/bcmail-jdk15-1.46.jar"/>
<classpathentry kind="lib" path="lib/bcprov-jdk15-1.46.jar"/>
<classpathentry kind="lib" path="lib/poi-3.13-20150929.jar"/>
<classpathentry kind="lib" path="lib/poi-scratchpad-3.13-20150929.jar"/>
<classpathentry kind="lib" path="lib/commons-io-2.4.jar"/>
<classpathentry kind="lib" path="lib/slf4j-api-1.7.12.jar"/>
<classpathentry kind="lib" path="lib/chardet.jar"/>
<classpathentry kind="lib" path="lib/jetty-client-9.2.11.v20150529.jar"/>
<classpathentry kind="lib" path="lib/jetty-continuation-9.2.11.v20150529.jar"/>
<classpathentry kind="lib" path="lib/jetty-deploy-9.2.11.v20150529.jar"/>
<classpathentry kind="lib" path="lib/jetty-http-9.2.11.v20150529.jar"/>
<classpathentry kind="lib" path="lib/jetty-io-9.2.11.v20150529.jar"/>
<classpathentry kind="lib" path="lib/jetty-jmx-9.2.11.v20150529.jar"/>
<classpathentry kind="lib" path="lib/jetty-proxy-9.2.11.v20150529.jar"/>
<classpathentry kind="lib" path="lib/jetty-security-9.2.11.v20150529.jar"/>
<classpathentry kind="lib" path="lib/jetty-server-9.2.11.v20150529.jar"/>
<classpathentry kind="lib" path="lib/jetty-servlet-9.2.11.v20150529.jar"/>
<classpathentry kind="lib" path="lib/jetty-servlets-9.2.11.v20150529.jar"/>
<classpathentry kind="lib" path="lib/jetty-util-9.2.11.v20150529.jar"/>
<classpathentry kind="lib" path="lib/jetty-webapp-9.2.11.v20150529.jar"/>
<classpathentry kind="lib" path="lib/jetty-xml-9.2.11.v20150529.jar"/>
<classpathentry kind="lib" path="lib/httpclient-4.5.jar"/>
<classpathentry kind="lib" path="lib/httpmime-4.5.jar"/>
<classpathentry kind="lib" path="lib/noggit-0.6.jar"/>
<classpathentry kind="lib" path="lib/solr-core-5.3.1.jar"/>
<classpathentry kind="lib" path="lib/solr-solrj-5.3.1.jar"/>
<classpathentry kind="lib" path="lib/stax2-api-3.1.4.jar"/>
<classpathentry kind="lib" path="lib/woodstox-core-asl-4.4.1.jar"/>
<classpathentry kind="lib" path="lib/lucene-analyzers-common-5.3.1.jar"/>
<classpathentry kind="lib" path="lib/lucene-analyzers-phonetic-5.3.1.jar"/>
<classpathentry kind="lib" path="lib/lucene-classification-5.3.1.jar"/>
<classpathentry kind="lib" path="lib/lucene-codecs-5.3.1.jar"/>
<classpathentry kind="lib" path="lib/lucene-core-5.3.1.jar"/>
<classpathentry kind="lib" path="lib/lucene-facet-5.3.1.jar"/>
<classpathentry kind="lib" path="lib/lucene-grouping-5.3.1.jar"/>
<classpathentry kind="lib" path="lib/lucene-highlighter-5.3.1.jar"/>
<classpathentry kind="lib" path="lib/lucene-join-5.3.1.jar"/>
<classpathentry kind="lib" path="lib/lucene-memory-5.3.1.jar"/>
<classpathentry kind="lib" path="lib/lucene-misc-5.3.1.jar"/>
<classpathentry kind="lib" path="lib/lucene-queries-5.3.1.jar"/>
<classpathentry kind="lib" path="lib/lucene-queryparser-5.3.1.jar"/>
<classpathentry kind="lib" path="lib/lucene-spatial-5.3.1.jar"/>
<classpathentry kind="lib" path="lib/lucene-suggest-5.3.1.jar"/>
<classpathentry kind="lib" path="lib/lucene-backward-codecs-5.3.1.jar"/>
<classpathentry kind="con" path="org.eclipse.jdt.junit.JUNIT_CONTAINER/4"/>
<classpathentry kind="lib" path="lib/icu4j-55_1.jar"/>
<classpathentry kind="lib" path="lib/htmllexer.jar"/>
<classpathentry kind="lib" path="lib/jsoup-1.8.3.jar"/>
<classpathentry kind="lib" path="lib/javax.servlet-api-3.1.0.jar"/>
<classpathentry kind="lib" path="lib/weupnp-0.1.3.jar"/>
<classpathentry kind="output" path="gen"/>
</classpath>
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry kind="src" path="source"/>
<classpathentry kind="src" path="test"/>
<classpathentry excluding="api/|env/|processing/domaingraph/applet/|yacy/|api/bookmarks/|api/ymarks/|api/bookmarks/posts/|api/bookmarks/tags/|api/bookmarks/xbel/|solr/|gsa/|solr/collection1/|api/blacklists/" kind="src" path="htroot"/>
<classpathentry excluding="bookmarks/|ymarks/|bookmarks/posts/|bookmarks/tags/|bookmarks/xbel/|blacklists/" kind="src" path="htroot/api"/>
<classpathentry kind="src" path="htroot/env"/>
<classpathentry kind="src" path="htroot/yacy"/>
<classpathentry excluding="posts/|tags/|xbel/" kind="src" path="htroot/api/bookmarks"/>
<classpathentry kind="src" path="htroot/api/ymarks"/>
<classpathentry kind="src" path="htroot/api/bookmarks/posts"/>
<classpathentry kind="src" path="htroot/api/bookmarks/tags"/>
<classpathentry kind="src" path="htroot/api/bookmarks/xbel"/>
<classpathentry kind="src" path="htroot/api/blacklists"/>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
<classpathentry kind="lib" path="lib/commons-logging-1.2.jar"/>
<classpathentry kind="lib" path="lib/J7Zip-modified.jar"/>
<classpathentry kind="lib" path="lib/webcat-0.1-swf.jar"/>
<classpathentry kind="lib" path="lib/commons-jxpath-1.3.jar"/>
<classpathentry kind="lib" path="lib/jsch-0.1.53.jar"/>
<classpathentry kind="lib" path="lib/jakarta-oro-2.0.8.jar"/>
<classpathentry kind="lib" path="lib/apache-mime4j-0.6.jar"/>
<classpathentry kind="lib" path="lib/commons-fileupload-1.3.1.jar"/>
<classpathentry kind="lib" path="lib/json-simple-1.1.1.jar"/>
<classpathentry kind="lib" path="lib/xercesImpl.jar"/>
<classpathentry kind="lib" path="lib/xml-apis.jar"/>
<classpathentry kind="lib" path="lib/commons-compress-1.9.jar"/>
<classpathentry kind="lib" path="lib/commons-lang-2.6.jar"/>
<classpathentry kind="lib" path="lib/jaudiotagger-2.0.4-20111207.115108-15.jar"/>
<classpathentry kind="lib" path="lib/commons-codec-1.10.jar"/>
<classpathentry kind="lib" path="lib/jcl-over-slf4j-1.7.12.jar"/>
<classpathentry kind="lib" path="lib/slf4j-jdk14-1.7.12.jar"/>
<classpathentry kind="lib" path="lib/log4j-over-slf4j-1.7.12.jar"/>
<classpathentry kind="lib" path="lib/httpcore-4.4.1.jar"/>
<classpathentry kind="lib" path="lib/metadata-extractor-2.8.1.jar"/>
<classpathentry kind="lib" path="lib/xmpcore-5.1.2.jar"/>
<classpathentry kind="lib" path="lib/jcifs-1.3.17.jar"/>
<classpathentry kind="lib" path="lib/guava-18.0.jar"/>
<classpathentry kind="lib" path="lib/spatial4j-0.4.1.jar"/>
<classpathentry kind="lib" path="lib/zookeeper-3.4.6.jar"/>
<classpathentry kind="lib" path="lib/org.restlet.jar"/>
<classpathentry kind="lib" path="lib/fontbox-1.8.10.jar"/>
<classpathentry kind="lib" path="lib/jempbox-1.8.10.jar"/>
<classpathentry kind="lib" path="lib/pdfbox-1.8.10.jar"/>
<classpathentry kind="lib" path="lib/bcmail-jdk15-1.46.jar"/>
<classpathentry kind="lib" path="lib/bcprov-jdk15-1.46.jar"/>
<classpathentry kind="lib" path="lib/poi-3.13-20150929.jar"/>
<classpathentry kind="lib" path="lib/poi-scratchpad-3.13-20150929.jar"/>
<classpathentry kind="lib" path="lib/commons-io-2.4.jar"/>
<classpathentry kind="lib" path="lib/slf4j-api-1.7.12.jar"/>
<classpathentry kind="lib" path="lib/chardet.jar"/>
<classpathentry kind="lib" path="lib/jetty-client-9.2.11.v20150529.jar"/>
<classpathentry kind="lib" path="lib/jetty-continuation-9.2.11.v20150529.jar"/>
<classpathentry kind="lib" path="lib/jetty-deploy-9.2.11.v20150529.jar"/>
<classpathentry kind="lib" path="lib/jetty-http-9.2.11.v20150529.jar"/>
<classpathentry kind="lib" path="lib/jetty-io-9.2.11.v20150529.jar"/>
<classpathentry kind="lib" path="lib/jetty-jmx-9.2.11.v20150529.jar"/>
<classpathentry kind="lib" path="lib/jetty-proxy-9.2.11.v20150529.jar"/>
<classpathentry kind="lib" path="lib/jetty-security-9.2.11.v20150529.jar"/>
<classpathentry kind="lib" path="lib/jetty-server-9.2.11.v20150529.jar"/>
<classpathentry kind="lib" path="lib/jetty-servlet-9.2.11.v20150529.jar"/>
<classpathentry kind="lib" path="lib/jetty-servlets-9.2.11.v20150529.jar"/>
<classpathentry kind="lib" path="lib/jetty-util-9.2.11.v20150529.jar"/>
<classpathentry kind="lib" path="lib/jetty-webapp-9.2.11.v20150529.jar"/>
<classpathentry kind="lib" path="lib/jetty-xml-9.2.11.v20150529.jar"/>
<classpathentry kind="lib" path="lib/httpclient-4.5.jar"/>
<classpathentry kind="lib" path="lib/httpmime-4.5.jar"/>
<classpathentry kind="lib" path="lib/noggit-0.6.jar"/>
<classpathentry kind="lib" path="lib/solr-core-5.3.1.jar"/>
<classpathentry kind="lib" path="lib/solr-solrj-5.3.1.jar"/>
<classpathentry kind="lib" path="lib/stax2-api-3.1.4.jar"/>
<classpathentry kind="lib" path="lib/woodstox-core-asl-4.4.1.jar"/>
<classpathentry kind="lib" path="lib/lucene-analyzers-common-5.3.1.jar"/>
<classpathentry kind="lib" path="lib/lucene-analyzers-phonetic-5.3.1.jar"/>
<classpathentry kind="lib" path="lib/lucene-classification-5.3.1.jar"/>
<classpathentry kind="lib" path="lib/lucene-codecs-5.3.1.jar"/>
<classpathentry kind="lib" path="lib/lucene-core-5.3.1.jar"/>
<classpathentry kind="lib" path="lib/lucene-facet-5.3.1.jar"/>
<classpathentry kind="lib" path="lib/lucene-grouping-5.3.1.jar"/>
<classpathentry kind="lib" path="lib/lucene-highlighter-5.3.1.jar"/>
<classpathentry kind="lib" path="lib/lucene-join-5.3.1.jar"/>
<classpathentry kind="lib" path="lib/lucene-memory-5.3.1.jar"/>
<classpathentry kind="lib" path="lib/lucene-misc-5.3.1.jar"/>
<classpathentry kind="lib" path="lib/lucene-queries-5.3.1.jar"/>
<classpathentry kind="lib" path="lib/lucene-queryparser-5.3.1.jar"/>
<classpathentry kind="lib" path="lib/lucene-spatial-5.3.1.jar"/>
<classpathentry kind="lib" path="lib/lucene-suggest-5.3.1.jar"/>
<classpathentry kind="lib" path="lib/lucene-backward-codecs-5.3.1.jar"/>
<classpathentry kind="con" path="org.eclipse.jdt.junit.JUNIT_CONTAINER/4"/>
<classpathentry kind="lib" path="lib/icu4j-55_1.jar"/>
<classpathentry kind="lib" path="lib/htmllexer.jar"/>
<classpathentry kind="lib" path="lib/jsoup-1.8.3.jar"/>
<classpathentry kind="lib" path="lib/javax.servlet-api-3.1.0.jar"/>
<classpathentry kind="lib" path="lib/weupnp-0.1.3.jar"/>
<classpathentry kind="lib" path="lib/common-image-3.1.2.jar"/>
<classpathentry kind="lib" path="lib/common-io-3.1.2.jar"/>
<classpathentry kind="lib" path="lib/common-lang-3.1.2.jar"/>
<classpathentry kind="lib" path="lib/imageio-core-3.1.2.jar"/>
<classpathentry kind="lib" path="lib/imageio-metadata-3.1.2.jar"/>
<classpathentry kind="lib" path="lib/imageio-tiff-3.1.2.jar"/>
<classpathentry kind="lib" path="lib/servlet-3.1.2.jar"/>
<classpathentry kind="output" path="gen"/>
</classpath>

@ -165,6 +165,9 @@
<pathelement location="${lib}/bcmail-jdk15-1.46.jar" />
<pathelement location="${lib}/bcprov-jdk15-1.46.jar" />
<pathelement location="${lib}/chardet.jar" />
<pathelement location="${lib}/common-image-3.1.2.jar" />
<pathelement location="${lib}/common-io-3.1.2.jar" />
<pathelement location="${lib}/common-lang-3.1.2.jar" />
<pathelement location="${lib}/commons-codec-1.10.jar" />
<pathelement location="${lib}/commons-compress-1.9.jar" />
<pathelement location="${lib}/commons-fileupload-1.3.1.jar" />
@ -179,6 +182,9 @@
<pathelement location="${lib}/httpcore-4.4.1.jar" />
<pathelement location="${lib}/httpmime-4.5.jar" />
<pathelement location="${lib}/icu4j-55_1.jar" />
<pathelement location="${lib}/imageio-core-3.1.2.jar" />
<pathelement location="${lib}/imageio-metadata-3.1.2.jar" />
<pathelement location="${lib}/imageio-tiff-3.1.2.jar" />
<pathelement location="${lib}/J7Zip-modified.jar" />
<pathelement location="${lib}/jakarta-oro-2.0.8.jar" />
<pathelement location="${lib}/jaudiotagger-2.0.4-20111207.115108-15.jar" />
@ -226,6 +232,7 @@
<pathelement location="${lib}/pdfbox-1.8.10.jar" />
<pathelement location="${lib}/poi-3.13-20150929.jar" />
<pathelement location="${lib}/poi-scratchpad-3.13-20150929.jar" />
<pathelement location="${lib}/servlet-3.1.2.jar" />
<pathelement location="${lib}/slf4j-api-1.7.12.jar" />
<pathelement location="${lib}/slf4j-jdk14-1.7.12.jar" />
<pathelement location="${lib}/solr-core-5.3.1.jar" />

@ -131,7 +131,7 @@ public class ViewImage {
if (resourceb == null) {
if (urlString.endsWith(".ico")) {
// load default favicon dfltfvcn.ico
// Should not do this in context of search image result of 'ico' type ?
// Should not do this here : we can be displaying search image result of '.ico' type and do not want to display a default
if (defaulticonb == null)
try {
resourceb = FileUtils.read(new File(sb.getAppPath(), defaulticon));

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

@ -395,6 +395,11 @@
<artifactId>commons-logging</artifactId>
<version>1.2</version>
</dependency>
<dependency>
<groupId>com.twelvemonkeys.imageio</groupId>
<artifactId>imageio-tiff</artifactId>
<version>3.1.2</version>
</dependency>
<dependency>
<groupId>org.apache.pdfbox</groupId>
<artifactId>fontbox</artifactId>

@ -23,8 +23,12 @@ package net.yacy.document;
import java.awt.Container;
import java.awt.Image;
import java.awt.MediaTracker;
import java.awt.Toolkit;
import java.io.ByteArrayInputStream;
import java.io.IOException;
import javax.imageio.ImageIO;
import net.yacy.cora.util.ConcurrentLog;
import net.yacy.document.parser.images.bmpParser;
import net.yacy.document.parser.images.icoParser;
@ -32,7 +36,7 @@ public class ImageParser {
public static final Image parse(final String filename, final byte[] source) {
final MediaTracker mediaTracker = new MediaTracker(new Container());
Image image;
Image image = null;
if (((filename.endsWith(".ico")) || (filename.endsWith(".bmp"))) && (bmpParser.isBMP(source))) {
// parse image with BMP parser
image = bmpParser.parse(source).getImage();
@ -44,27 +48,19 @@ public class ImageParser {
icoparser = new icoParser(source);
image = icoparser.getImage(0);
} catch (final Throwable e) {
image = null;
if (ConcurrentLog.isFine("IMAGEPARSER")) {
ConcurrentLog.fine("IMAGEPARSER", "IMAGEPARSER.parse : could not parse image " + filename, e);
}
}
if (image == null) return null;
} else {
// awt can handle jpg, png and gif formats, try it
image = Toolkit.getDefaultToolkit().createImage(source);
/*
try {
ImageIO.setUseCache(false); // do not write a cache to disc; keep in RAM
image = ImageIO.read(new ByteArrayInputStream(source));
} catch (final IOException e) {
Image i = Toolkit.getDefaultToolkit().createImage(source);
mediaTracker.addImage(i, 0);
try {mediaTracker.waitForID(0);} catch (final InterruptedException ee) {}
int width = i.getWidth(null); if (width < 0) width = 96; // bad hack
int height = i.getHeight(null); if (height < 0) height = 96; // bad hack
image = new BufferedImage(width, height, BufferedImage.TYPE_INT_RGB);
image.createGraphics().drawImage(i, 0, 0, width, height, null);
}
*/
try {
image = ImageIO.read(new ByteArrayInputStream(source));
} catch(IOException e) {
if (ConcurrentLog.isFine("IMAGEPARSER")) {
ConcurrentLog.fine("IMAGEPARSER", "IMAGEPARSER.parse : could not parse image " + filename, e);
}
}
}
final int handle = image.hashCode();

Loading…
Cancel
Save