Michael Peter Christen 9 years ago
commit 092dac086e

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

@ -1,3 +1,4 @@
// ViewImage.java // ViewImage.java
// ----------------------- // -----------------------
// part of YaCy // part of YaCy
@ -21,6 +22,7 @@
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
import java.awt.Container; import java.awt.Container;
import java.awt.Dimension;
import java.awt.Graphics2D; import java.awt.Graphics2D;
import java.awt.Image; import java.awt.Image;
import java.awt.MediaTracker; import java.awt.MediaTracker;
@ -54,183 +56,296 @@ import net.yacy.server.serverSwitch;
public class ViewImage { public class ViewImage {
private static Map<String, Image> iconcache = new ConcurrentARC<String, Image>(1000, Math.max(10, Math.min(32, WorkflowProcessor.availableCPU * 2))); private static Map<String, Image> iconcache = new ConcurrentARC<String, Image>(1000,
private static String defaulticon = "htroot/env/grafics/dfltfvcn.ico"; Math.max(10, Math.min(32, WorkflowProcessor.availableCPU * 2)));
private static byte[] defaulticonb; private static String defaulticon = "htroot/env/grafics/dfltfvcn.ico";
static { private static byte[] defaulticonb;
try {
defaulticonb = FileUtils.read(new File(defaulticon)); static {
} catch (final IOException e) { try {
} defaulticonb = FileUtils.read(new File(defaulticon));
} } catch (final IOException e) {
}
public static Object respond(final RequestHeader header, final serverObjects post, final serverSwitch env) { }
final Switchboard sb = (Switchboard)env; public static Object respond(final RequestHeader header, final serverObjects post, final serverSwitch env) {
// the url to the image can be either submitted with an url in clear text, or using a license key final Switchboard sb = (Switchboard) env;
// if the url is given as clear text, the user must be authorized as admin
// the license can be used also from non-authorized users // the url to the image can be either submitted with an url in clear
// text, or using a license key
String urlString = post.get("url", ""); // if the url is given as clear text, the user must be authorized as
final String urlLicense = post.get("code", ""); // admin
boolean isStatic = post.getBoolean("isStatic"); // the license can be used also from non-authorized users
String ext = header.get("EXT", null);
final boolean quadratic = post.containsKey("quadratic"); String urlString = post.get("url", "");
final boolean auth = Domains.isLocalhost(header.get(HeaderFramework.CONNECTION_PROP_CLIENTIP, "")) || sb.verifyAuthentication(header); // handle access rights final String urlLicense = post.get("code", "");
String ext = header.get("EXT", null);
DigestURL url = null; final boolean auth = Domains.isLocalhost(header.get(HeaderFramework.CONNECTION_PROP_CLIENTIP, ""))
if ((urlString.length() > 0) && (auth)) try { || sb.verifyAuthentication(header); // handle access rights
url = new DigestURL(urlString);
} catch (final MalformedURLException e1) { DigestURL url = null;
url = null; if ((urlString.length() > 0) && (auth))
} try {
url = new DigestURL(urlString);
if ((url == null) && (urlLicense.length() > 0)) { } catch (final MalformedURLException e1) {
urlString = URLLicense.releaseLicense(urlLicense); url = null;
try { }
url = new DigestURL(urlString);
} catch (final MalformedURLException e1) { if ((url == null) && (urlLicense.length() > 0)) {
url = null; urlString = URLLicense.releaseLicense(urlLicense);
urlString = null; try {
} url = new DigestURL(urlString);
} } catch (final MalformedURLException e1) {
url = null;
if (urlString == null) return null; urlString = null;
}
int width = post.getInt("width", 0); }
int height = post.getInt("height", 0);
int maxwidth = post.getInt("maxwidth", 0); if (urlString == null) {
int maxheight = post.getInt("maxheight", 0); return null;
}
// get the image as stream
if (MemoryControl.shortStatus()) iconcache.clear();
Image image = iconcache.get(urlString); // get the image as stream
if (image == null) { if (MemoryControl.shortStatus()) {
byte[] resourceb = null; iconcache.clear();
if (url != null) try { }
String agentName = post.get("agentName", auth ? ClientIdentification.yacyIntranetCrawlerAgentName : ClientIdentification.yacyInternetCrawlerAgentName); EncodedImage encodedImage = null;
ClientIdentification.Agent agent = ClientIdentification.getAgent(agentName); Image image = iconcache.get(urlString);
resourceb = sb.loader.loadContent(sb.loader.request(url, false, true), CacheStrategy.IFEXIST, BlacklistType.SEARCH, agent); if (image != null) {
} catch (final IOException e) { encodedImage = new EncodedImage(image, ext, post.getBoolean("isStatic"));
ConcurrentLog.fine("ViewImage", "cannot load: " + e.getMessage()); } else {
} byte[] resourceb = null;
boolean okToCache = true; if (url != null)
if (resourceb == null) { try {
if (urlString.endsWith(".ico")) { String agentName = post.get("agentName", auth ? ClientIdentification.yacyIntranetCrawlerAgentName
// load default favicon dfltfvcn.ico : ClientIdentification.yacyInternetCrawlerAgentName);
if (defaulticonb == null) try { ClientIdentification.Agent agent = ClientIdentification.getAgent(agentName);
resourceb = FileUtils.read(new File(sb.getAppPath(), defaulticon)); resourceb = sb.loader.loadContent(sb.loader.request(url, false, true), CacheStrategy.IFEXIST,
okToCache = false; BlacklistType.SEARCH, agent);
} catch (final IOException e) { } catch (final IOException e) {
return null; ConcurrentLog.fine("ViewImage", "cannot load: " + e.getMessage());
} else { }
resourceb = defaulticonb; boolean okToCache = true;
okToCache = false; if (resourceb == null) {
} if (urlString.endsWith(".ico")) {
} else { // load default favicon dfltfvcn.ico
return null; // 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));
// gif images are not loaded because of an animated gif bug within jvm which sends java into an endless loop with high CPU okToCache = false;
if (ext.equals("gif") && "gif".equals(MultiProtocolURL.getFileExtension(url.getFileName()))) { } catch (final IOException e) {
return new ByteArrayInputStream(resourceb); return null;
} else if (ext.equals("svg") && "svg".equals(MultiProtocolURL.getFileExtension(url.getFileName()))) { }
// svg images not supported by awt, but by most browser, deliver just content (without crop/scale) else {
return new ByteArrayInputStream(resourceb); resourceb = defaulticonb;
} okToCache = false;
}
// read image } else {
image = ImageParser.parse(urlString, resourceb); return null;
if (image == null) { }
return null; }
}
if ((auth && (width == 0 || height == 0) && maxwidth == 0 && maxheight == 0)) return ext == null ? image : new EncodedImage(image, ext, isStatic); // gif images are not loaded because of an animated gif bug within
// find original size // jvm which sends java into an endless loop with high CPU
final int h = image.getHeight(null); if (ext.equals("gif") && "gif".equals(MultiProtocolURL.getFileExtension(url.getFileName()))) {
final int w = image.getWidth(null); return new ByteArrayInputStream(resourceb);
} else if (ext.equals("svg") && "svg".equals(MultiProtocolURL.getFileExtension(url.getFileName()))) {
// if a quadratic flag is set, we cut the image out to be in quadratic shape // svg images not supported by awt, but by most browser, deliver
if (quadratic && w != h) { // just content (without crop/scale)
if (w > h) { return new ByteArrayInputStream(resourceb);
final BufferedImage dst = new BufferedImage(h, h, BufferedImage.TYPE_INT_RGB); }
Graphics2D g = dst.createGraphics();
g.drawImage(image, 0, 0, h - 1, h - 1, (w - h) / 2, 0, h + (w - h) / 2, h - 1, null); // read image
g.dispose(); encodedImage = parseAndScale(post, auth, urlString, ext, okToCache, resourceb);
image = dst; }
} else {
final BufferedImage dst = new BufferedImage(w, w, BufferedImage.TYPE_INT_RGB); return encodedImage;
Graphics2D g = dst.createGraphics(); }
g.drawImage(image, 0, 0, w - 1, w - 1, 0, (h - w) / 2, w - 1, w + (h - w) / 2, null);
g.dispose(); /**
image = dst; * Process resourceb byte array to try to produce an Image instance eventually scaled and cropped depending on post parameters
} * @param post request post parameters. Must not be null.
} * @param auth true when access rigths are OK.
* @param urlString image source URL. Must not be null.
// in case of not-authorized access shrink the image to prevent * @param ext image file extension. May be null.
// copyright problems, so that images are not larger than thumbnails * @param okToCache true when image can be cached
if (auth) { * @param resourceb byte array. Must not be null.
maxwidth = (maxwidth == 0) ? w : maxwidth; * @return an Image instance when parsing is OK, or null.
maxheight = (maxheight == 0) ? h : maxheight; */
} else if ((w > 16) || (h > 16)) { protected static EncodedImage parseAndScale(serverObjects post, boolean auth, String urlString, String ext, boolean okToCache, byte[] resourceb) {
maxwidth = Math.min(96, w); EncodedImage encodedImage = null;
maxheight = Math.min(96, h);
} else { Image image = ImageParser.parse(urlString, resourceb);
maxwidth = 16;
maxheight = 16; if (image != null) {
} int width = post.getInt("width", 0);
int height = post.getInt("height", 0);
// calculate width & height from maxwidth & maxheight int maxwidth = post.getInt("maxwidth", 0);
if (maxwidth < w || maxheight < h) { int maxheight = post.getInt("maxheight", 0);
// scale image final boolean quadratic = post.containsKey("quadratic");
final double hs = (w <= maxwidth) ? 1.0 : ((double) maxwidth) / ((double) w); boolean isStatic = post.getBoolean("isStatic");
final double vs = (h <= maxheight) ? 1.0 : ((double) maxheight) / ((double) h); if (!auth || (width != 0 && height != 0) || maxwidth != 0 || maxheight != 0) {
final double scale = Math.min(hs, vs);
//if (!auth) scale = Math.min(scale, 0.6); // this is for copyright purpose // find original size
if (scale < 1.0) { final int h = image.getHeight(null);
width = Math.max(1, (int) (w * scale)); final int w = image.getWidth(null);
height = Math.max(1, (int) (h * scale));
} else { // in case of not-authorized access shrink the image to
width = Math.max(1, w); // prevent
height = Math.max(1, h); // copyright problems, so that images are not larger than
} // thumbnails
Dimension maxDimensions = calculateMaxDimensions(auth, w, h, maxwidth, maxheight);
if (w != width && h != height) {
// compute scaled image // if a quadratic flag is set, we cut the image out to be in
final Image scaled = image.getScaledInstance(width, height, Image.SCALE_AREA_AVERAGING); // quadratic shape
final MediaTracker mediaTracker = new MediaTracker(new Container()); if (quadratic && w != h) {
mediaTracker.addImage(scaled, 0); image = makeSquare(image, h, w);
try {mediaTracker.waitForID(0);} catch (final InterruptedException e) {} }
// make a BufferedImage out of that Dimension finalDimensions = calculateDimensions(w, h, width, height, maxDimensions);
final BufferedImage i = new BufferedImage(width, height, BufferedImage.TYPE_INT_RGB);
try { if (w != finalDimensions.width && h != finalDimensions.height) {
i.createGraphics().drawImage(scaled, 0, 0, width, height, null); image = scale(finalDimensions.width, finalDimensions.height, image);
image = i;
// check outcome }
final Raster raster = i.getData();
int[] pixel = new int[3]; if ((finalDimensions.width == 16) && (finalDimensions.height == 16) && okToCache) {
pixel = raster.getPixel(0, 0, pixel); // this might be a favicon, store image to cache for
if (pixel[0] != 0 || pixel[1] != 0 || pixel[2] != 0) image = i; // faster
} catch (final Exception e) { // re-load later on
//java.lang.ClassCastException: [I cannot be cast to [B iconcache.put(urlString, image);
} }
}
} encodedImage = new EncodedImage(image, ext, isStatic);
} else { }
// do not scale return encodedImage;
width = w; }
height = h;
} /**
* Calculate image dimensions from image original dimensions, max
if ((height == 16) && (width == 16) && okToCache) { * dimensions, and target dimensions.
// this might be a favicon, store image to cache for faster re-load later on *
iconcache.put(urlString, image); * @return dimensions to render image
} */
} protected static Dimension calculateDimensions(final int originWidth, final int originHeight, final int targetWidth,
final int targetHeight, final Dimension max) {
return ext == null ? image : new EncodedImage(image, ext, isStatic); int resultWidth = targetWidth;
} int resultHeight = targetHeight;
if (max.width < originWidth || max.height < originHeight) {
// scale image
final double hs = (originWidth <= max.width) ? 1.0 : ((double) max.width) / ((double) originWidth);
final double vs = (originHeight <= max.height) ? 1.0 : ((double) max.height) / ((double) originHeight);
final double scale = Math.min(hs, vs);
// if (!auth) scale = Math.min(scale, 0.6); // this is for copyright
// purpose
if (scale < 1.0) {
resultWidth = Math.max(1, (int) (originWidth * scale));
resultHeight = Math.max(1, (int) (originHeight * scale));
} else {
resultWidth = Math.max(1, originWidth);
resultHeight = Math.max(1, originHeight);
}
} else {
// do not scale
resultWidth = originWidth;
resultHeight = originHeight;
}
return new Dimension(resultWidth, resultHeight);
}
/**
* Calculate image maximum dimentions from original and specified maximum
* dimensions
*
* @param auth
* true when acces rigths are OK.
* @return maximum dimensions to render image
*/
protected static Dimension calculateMaxDimensions(final boolean auth, final int originWidth, final int originHeight,
final int maxWidth, final int maxHeight) {
int resultWidth;
int resultHeight;
// in case of not-authorized access shrink the image to prevent
// copyright problems, so that images are not larger than thumbnails
if (auth) {
resultWidth = (maxWidth == 0) ? originWidth : maxWidth;
resultHeight = (maxHeight == 0) ? originHeight : maxHeight;
} else if ((originWidth > 16) || (originHeight > 16)) {
resultWidth = Math.min(96, originWidth);
resultHeight = Math.min(96, originHeight);
} else {
resultWidth = 16;
resultHeight = 16;
}
return new Dimension(resultWidth, resultHeight);
}
/**
* Scale image to specified dimensions
*
* @param width
* target width
* @param height
* target height
* @param image
* image to scale. Must not be null.
* @return a scaled image
*/
protected static Image scale(final int width, final int height, Image image) {
// compute scaled image
final Image scaled = image.getScaledInstance(width, height, Image.SCALE_AREA_AVERAGING);
final MediaTracker mediaTracker = new MediaTracker(new Container());
mediaTracker.addImage(scaled, 0);
try {
mediaTracker.waitForID(0);
} catch (final InterruptedException e) {
}
// make a BufferedImage out of that
final BufferedImage i = new BufferedImage(width, height, BufferedImage.TYPE_INT_RGB);
try {
i.createGraphics().drawImage(scaled, 0, 0, width, height, null);
image = i;
// check outcome
final Raster raster = i.getData();
int[] pixel = new int[3];
pixel = raster.getPixel(0, 0, pixel);
if (pixel[0] != 0 || pixel[1] != 0 || pixel[2] != 0)
image = i;
} catch (final Exception e) {
// java.lang.ClassCastException: [I cannot be cast to [B
}
return image;
}
/**
* Crop image to make a square
*
* @param image
* image to crop
* @param h
* @param w
* @return
*/
protected static Image makeSquare(Image image, final int h, final int w) {
if (w > h) {
final BufferedImage dst = new BufferedImage(h, h, BufferedImage.TYPE_INT_RGB);
Graphics2D g = dst.createGraphics();
g.drawImage(image, 0, 0, h - 1, h - 1, (w - h) / 2, 0, h + (w - h) / 2, h - 1, null);
g.dispose();
image = dst;
} else {
final BufferedImage dst = new BufferedImage(w, w, BufferedImage.TYPE_INT_RGB);
Graphics2D g = dst.createGraphics();
g.drawImage(image, 0, 0, w - 1, w - 1, 0, (h - w) / 2, w - 1, w + (h - w) / 2, null);
g.dispose();
image = dst;
}
return image;
}
} }

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> <artifactId>commons-logging</artifactId>
<version>1.2</version> <version>1.2</version>
</dependency> </dependency>
<dependency>
<groupId>com.twelvemonkeys.imageio</groupId>
<artifactId>imageio-tiff</artifactId>
<version>3.1.2</version>
</dependency>
<dependency> <dependency>
<groupId>org.apache.pdfbox</groupId> <groupId>org.apache.pdfbox</groupId>
<artifactId>fontbox</artifactId> <artifactId>fontbox</artifactId>

@ -23,8 +23,12 @@ package net.yacy.document;
import java.awt.Container; import java.awt.Container;
import java.awt.Image; import java.awt.Image;
import java.awt.MediaTracker; 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.bmpParser;
import net.yacy.document.parser.images.icoParser; 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) { public static final Image parse(final String filename, final byte[] source) {
final MediaTracker mediaTracker = new MediaTracker(new Container()); final MediaTracker mediaTracker = new MediaTracker(new Container());
Image image; Image image = null;
if (((filename.endsWith(".ico")) || (filename.endsWith(".bmp"))) && (bmpParser.isBMP(source))) { if (((filename.endsWith(".ico")) || (filename.endsWith(".bmp"))) && (bmpParser.isBMP(source))) {
// parse image with BMP parser // parse image with BMP parser
image = bmpParser.parse(source).getImage(); image = bmpParser.parse(source).getImage();
@ -44,27 +48,19 @@ public class ImageParser {
icoparser = new icoParser(source); icoparser = new icoParser(source);
image = icoparser.getImage(0); image = icoparser.getImage(0);
} catch (final Throwable e) { } 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; if (image == null) return null;
} else { } else {
// awt can handle jpg, png and gif formats, try it try {
image = Toolkit.getDefaultToolkit().createImage(source); image = ImageIO.read(new ByteArrayInputStream(source));
/* } catch(IOException e) {
try { if (ConcurrentLog.isFine("IMAGEPARSER")) {
ImageIO.setUseCache(false); // do not write a cache to disc; keep in RAM ConcurrentLog.fine("IMAGEPARSER", "IMAGEPARSER.parse : could not parse image " + filename, e);
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);
}
*/
} }
final int handle = image.hashCode(); final int handle = image.hashCode();

@ -0,0 +1,171 @@
import java.io.File;
import java.io.FileInputStream;
import java.io.IOException;
import java.io.InputStream;
import java.net.URL;
import net.yacy.cora.util.ConcurrentLog;
import net.yacy.peers.graphics.EncodedImage;
import net.yacy.server.serverObjects;
// ViewImagePerfTest.java
// -----------------------
// part of YaCy
// (C) by Michael Peter Christen; mc@yacy.net
// first published on http://www.anomic.de
// Frankfurt, Germany, 2006
// created 03.04.2006
//
// This program is free software; you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation; either version 2 of the License, or
// (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
/**
* Test to measure image render performance by ViewImage
*
* @author luc
*
*/
public class ViewImagePerfTest {
/** Default image */
private static final String DEFAULT_IMG_RESOURCE = "/viewImageTest/test/JPEG_example_JPG_RIP_100.jpg";
/** Default render max width (JPEG_example_JPG_RIP_100.jpg width / 10) */
private static final int DEFAULT_MAX_WIDTH = 31;
/** Default render max height (JPEG_example_JPG_RIP_100.jpg height / 10) */
private static final int DEFAULT_MAX_HEIGHT = 23;
/** Default encoding format */
private static final String DEFAUL_EXT = "png";
/**
* @param testFile
* file to load
* @return testFile content as a bytes array
* @throws IOException
* when an error occured while loading
*/
private static byte[] getBytes(File testFile) throws IOException {
InputStream inStream = new FileInputStream(testFile);
byte[] res = new byte[inStream.available()];
try {
inStream.read(res);
} finally {
inStream.close();
}
return res;
}
/**
* @param args
* first item may contain file URL
* @return file to be used : specified as first in args or default one
*/
private static File getTestFile(String args[]) {
String fileURL;
if (args != null && args.length > 0) {
fileURL = args[0];
} else {
URL defaultURL = ViewImagePerfTest.class.getResource(DEFAULT_IMG_RESOURCE);
if (defaultURL == null) {
throw new IllegalArgumentException("File not found : " + DEFAULT_IMG_RESOURCE);
}
fileURL = defaultURL.getFile();
}
return new File(fileURL);
}
/**
* Build post parameters to used with ViewImage
*
* @param args
* main parameters : second and third items may respectively
* contain max width and max height
* @return a serverObjects instance
*/
private static serverObjects makePostParams(String args[]) {
serverObjects post = new serverObjects();
int maxWidth = DEFAULT_MAX_WIDTH;
if (args != null && args.length > 1) {
maxWidth = Integer.parseInt(args[1]);
}
post.put("maxwidth", String.valueOf(maxWidth));
int maxHeight = DEFAULT_MAX_HEIGHT;
if (args != null && args.length > 2) {
maxHeight = Integer.parseInt(args[2]);
}
post.put("maxheight", String.valueOf(maxHeight));
/* Make it square by default */
post.put("quadratic", "");
return post;
}
/**
*
* @param args
* main parameters : fourth item may contain extension
* @return extension to use for encoding
*/
private static String getEncodingExt(String args[]) {
String ext = DEFAUL_EXT;
if (args != null && args.length > 3) {
ext = args[3];
}
return ext;
}
/**
* Test image (JPEG_example_JPG_RIP_100.jpg) is scaled, and cropped.
*
* @throws IOException
*/
public static void main(String args[]) throws IOException {
File imgFile = getTestFile(args);
byte[] resourceb = getBytes(imgFile);
String ext = getEncodingExt(args);
serverObjects post = makePostParams(args);
String urlString = imgFile.getAbsolutePath();
System.out.println("Measuring ViewImage render with file : " + urlString + " encoded To : " + ext);
try {
/* Max test total time (s) */
int maxTotalTime = 20;
long beginTime, time, minTime = Long.MAX_VALUE, maxTime = 0, meanTime = 0, totalTime = 0;
int step = 0;
for (step = 0; (totalTime / 1000000000) < maxTotalTime; step++) {
beginTime = System.nanoTime();
EncodedImage img = ViewImage.parseAndScale(post, true, urlString, ext, false, resourceb);
time = System.nanoTime() - beginTime;
minTime = Math.min(minTime, time);
maxTime = Math.max(maxTime, time);
totalTime += time;
if (img == null) {
throw new IOException("Image render failed");
}
}
meanTime = totalTime / step;
System.out.println("Render total time (ms) : " + (totalTime) / 1000000 + " on " + step + " steps.");
System.out.println("Render mean time (ms) : " + (meanTime) / 1000000);
System.out.println("Render min time (ms) : " + (minTime) / 1000000);
System.out.println("Render max time (ms) : " + (maxTime) / 1000000);
} finally {
ConcurrentLog.shutdown();
}
}
}

@ -0,0 +1,464 @@
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<style>
/* container style for ViewImage render */
.thumbcontainer {
margin: 2px;
width: 128px;
height: 128px;
float: left;
}
/* container style for direct browser render */
.browserthumb {
margin: 2px;
width: 128px;
height: 128px;
overflow: hidden;
}
td {
max-width: 210px;
}
</style>
<title>ViewImage rendering tests</title>
</head>
<body>
<h2>
Test page to check ViewImage rendering with different image formats
listed in <a
href="http://www.iana.org/assignments/media-types/media-types.xhtml#image"
title="IANA Media Types">IANA Media Types page</a>, plus BMP format.
</h2>
<h3>Prerequisites</h3>
<ul>
<li>copy /yacy/test/viewImageTest/test folder in
/yacy/htroot/env/grafics</li>
<li>run a YaCy instance on localhost and 8090 port</li>
</ul>
<table>
<thead>
<tr>
<th></th>
<th></th>
<th></th>
<th></th>
<th colspan="2">Render method</th>
</tr>
<tr>
<th>Image format</th>
<th>Mime type</th>
<th>File name extensions</th>
<th>Long name/Description</th>
<th>YaCy ViewImage</th>
<th>Direct browser</th>
</tr>
</thead>
<tbody>
<tr>
<td>PNG : <a
href="https://upload.wikimedia.org/wikipedia/commons/4/47/PNG_transparency_demonstration_1.png"
title="sample source url">sample source</a></td>
<td>image/png</td>
<td>.png</td>
<td>Portable Network Graphics</td>
<td>
<div class="thumbcontainer">
<a
href="http://localhost:8090/ViewImage.png?url=http://localhost:8090/env/grafics/test/PNG_transparency_demonstration_1.png"
title="ViewImage render PNG sample in full size"> <img
src="http://localhost:8090/ViewImage.png?maxwidth=128&maxheight=128&quadratic&url=http://localhost:8090/env/grafics/test/PNG_transparency_demonstration_1.png"
width="128" height="128" alt="ViewImage PNG render failed" />
</a>
</div>
</td>
<td>
<div class="browserthumb">
<a
href="http://localhost:8090/env/grafics/test/PNG_transparency_demonstration_1.png"
title="Browser render PNG sample in full size"> <img
src="http://localhost:8090/env/grafics/test/PNG_transparency_demonstration_1.png"
height="100%" style="margin-left: -17%"
alt="Browser PNG render failed" />
</a>
</div>
</td>
</tr>
<tr>
<td>JPEG : <a
href="https://upload.wikimedia.org/wikipedia/commons/b/b4/JPEG_example_JPG_RIP_100.jpg"
title="sample source url">sample source</a></td>
<td>image/jpeg</td>
<td>.jpg, .jpeg, .jpe, .jif, .jfif, .jfi</td>
<td>Joint Photographic Experts Group</td>
<td>
<div class="thumbcontainer">
<a
href="http://localhost:8090/ViewImage.png?url=http://localhost:8090/env/grafics/test/JPEG_example_JPG_RIP_100.jpg"
title="Render JPEG sample in full size"> <img
src="http://localhost:8090/ViewImage.png?maxwidth=128&maxheight=128&quadratic&url=http://localhost:8090/env/grafics/test/JPEG_example_JPG_RIP_100.jpg"
width="128" height="128" alt="JPG render failed" />
</a>
</div>
</td>
<td>
<div class="browserthumb">
<a
href="http://localhost:8090/env/grafics/test/JPEG_example_JPG_RIP_100.jpg"
title="Render JPEG sample in full size"> <img
src="http://localhost:8090/env/grafics/test/JPEG_example_JPG_RIP_100.jpg"
height="100%" style="margin-left: -20%" alt="JPG render failed" />
</a>
</div>
</td>
</tr>
<tr>
<td>GIF : <a
href="https://upload.wikimedia.org/wikipedia/commons/a/a0/Sunflower_as_gif_websafe.gif"
title="sample source url">sample source</a></td>
<td>image/gif</td>
<td>.gif</td>
<td>Graphics Interchange Format</td>
<td>
<div class="thumbcontainer">
<a
href="http://localhost:8090/ViewImage.gif?url=http://localhost:8090/env/grafics/test/Sunflower_as_gif_websafe.gif"
title="Render GIF sample in full size"> <img
src="http://localhost:8090/ViewImage.gif?maxwidth=128&maxheight=128&quadratic&url=http://localhost:8090/env/grafics/test/Sunflower_as_gif_websafe.gif"
width="128" height="128" alt="GIF render failed" />
</a>
</div>
</td>
<td>
<div class="browserthumb">
<a
href="http://localhost:8090/env/grafics/test/Sunflower_as_gif_websafe.gif"
title="Render GIF sample in full size"> <img
src="http://localhost:8090/env/grafics/test/Sunflower_as_gif_websafe.gif"
width="100%" alt="GIF render failed" />
</a>
</div>
</td>
</tr>
<tr>
<td>Animated GIF : <a
href="https://upload.wikimedia.org/wikipedia/commons/2/2c/Rotating_earth_%28large%29.gif"
title="sample source url">sample source</a></td>
<td>image/gif</td>
<td>.gif</td>
<td>Graphics Interchange Format</td>
<td>
<div class="thumbcontainer">
<a
href="http://localhost:8090/ViewImage.gif?url=http://localhost:8090/env/grafics/test/Rotating_earth_%28large%29.gif"
title="Render animated GIF sample in full size"> <img
src="http://localhost:8090/ViewImage.gif?maxwidth=128&maxheight=128&quadratic&url=http://localhost:8090/env/grafics/test/Rotating_earth_%28large%29.gif"
width="128" height="128" alt="Animated GIF render failed" />
</a>
</div>
</td>
<td>
<div class="browserthumb">
<a
href="http://localhost:8090/env/grafics/test/Rotating_earth_%28large%29.gif"
title="Render animated GIF sample in full size"> <img
src="http://localhost:8090/env/grafics/test/Rotating_earth_%28large%29.gif"
width="128" height="128" alt="Animated GIF render failed" />
</a>
</div>
</td>
</tr>
<tr>
<td>SVG : <a
href="https://upload.wikimedia.org/wikipedia/commons/0/02/SVG_logo.svg"
title="sample source url">sample source</a></td>
<td>image/svg+xml</td>
<td>.svg, .svgz</td>
<td>Scalable Vector Graphics</td>
<td>
<div class="thumbcontainer">
<a
href="http://localhost:8090/ViewImage.svg?url=http://localhost:8090/env/grafics/test/SVG_Logo.svg"
title="Render SVG sample in full size"> <img
src="http://localhost:8090/ViewImage.svg?maxwidth=128&maxheight=128&quadratic&url=http://localhost:8090/env/grafics/test/SVG_Logo.svg"
width="128" height="128" alt="SVG render failed" />
</a>
</div>
</td>
<td>
<div class="browserthumb">
<a href="http://localhost:8090/env/grafics/test/SVG_Logo.svg"
title="Render SVG sample in full size"> <img
src="http://localhost:8090/env/grafics/test/SVG_Logo.svg"
width="128" height="128" alt="SVG render failed" />
</a>
</div>
</td>
</tr>
<tr>
<td>ICO : <a href="https://en.wikipedia.org/favicon.ico"
title="sample source url">sample source</a></td>
<td>image/vnd.microsoft.icon, image/x-icon (not registered at
IANA)</td>
<td>.ico</td>
<td>Graphics file format for computer icons</td>
<td>
<div class="thumbcontainer">
<a
href="http://localhost:8090/ViewImage.png?url=http://localhost:8090/env/grafics/test/favicon.ico"
title="Render ICO sample in full size"> <img
src="http://localhost:8090/ViewImage.png?maxwidth=128&maxheight=128&quadratic&url=http://localhost:8090/env/grafics/test/favicon.ico"
width="128" height="128" alt="ICO render failed" />
</a>
</div>
</td>
<td>
<div class="browserthumb">
<a href="http://localhost:8090/env/grafics/test/favicon.ico"
title="Render ICO sample in full size"> <img
src="http://localhost:8090/env/grafics/test/favicon.ico"
width="128" height="128" alt="ICO render failed" />
</a>
</div>
</td>
</tr>
<tr>
<td>BMP : <a
href="http://homepages.cae.wisc.edu/~ece533/images/sails.bmp"
title="sample source url">sample source</a></td>
<td>image/bmp (not registered at IANA), image/x-bmp (not
registered at IANA)</td>
<td>.bmp, .dib</td>
<td>Windows Bitmap</td>
<td>
<div class="thumbcontainer">
<a
href="http://localhost:8090/ViewImage.png?url=http://localhost:8090/env/grafics/test/sails.bmp"
title="Render BMP sample in full size"> <img
src="http://localhost:8090/ViewImage.png?maxwidth=128&maxheight=128&quadratic&url=http://localhost:8090/env/grafics/test/sails.bmp"
width="128" height="128" alt="BMP render failed" />
</a>
</div>
</td>
<td>
<div class="browserthumb">
<a href="http://localhost:8090/env/grafics/test/sails.bmp"
title="Render BMP sample in full size"> <img
src="http://localhost:8090/env/grafics/test/sails.bmp"
width="128" height="128" alt="BMP render failed" />
</a>
</div>
</td>
</tr>
<tr>
<td>CGM : <a
href="http://www.agocg.ac.uk/train/cgm/ralcgm/sample.cgm"
title="sample source url">sample source</a></td>
<td>image/cgm</td>
<td>.cgm</td>
<td>Computer Graphics Metafile</td>
<td>
<div class="thumbcontainer">
<a
href="http://localhost:8090/ViewImage.png?url=http://localhost:8090/env/grafics/test/sample.cgm"
title="Render CGM sample in full size"> <img
src="http://localhost:8090/ViewImage.png?maxwidth=128&maxheight=128&quadratic&url=http://localhost:8090/env/grafics/test/sample.cgm"
width="128" height="128" alt="CGM render failed" />
</a>
</div>
</td>
<td>
<div class="browserthumb">
<a href="http://localhost:8090/env/grafics/test/sample.cgm"
title="Render CGM sample in full size"> <img
src="http://localhost:8090/env/grafics/test/sample.cgm"
width="128" height="128" alt="CGM render failed" />
</a>
</div>
</td>
</tr>
<tr>
<td>TIFF : <a
href="http://www.uswebsitecreations.com/images/digital_images/marbles.tif"
title="sample source url">sample source</a></td>
<td>image/tiff, image/tiff-fx</td>
<td>.tiff, .tif</td>
<td>Tagged Image File Format</td>
<td>
<div class="thumbcontainer">
<a
href="http://localhost:8090/ViewImage.png?url=http://localhost:8090/env/grafics/test/marbles.tif"
title="Render TIFF sample in full size"> <img
src="http://localhost:8090/ViewImage.png?maxwidth=128&maxheight=128&quadratic&url=http://localhost:8090/env/grafics/test/marbles.tif"
width="128" height="128" alt="TIFF render failed" />
</a>
</div>
</td>
<td>
<div class="browserthumb">
<a href="http://localhost:8090/env/grafics/test/marbles.tif"
title="Render TIFF sample in full size"> <img
src="http://localhost:8090/env/grafics/test/marbles.tif"
width="128" height="128" alt="TIFF render failed" />
</a>
</div>
</td>
</tr>
<tr>
<td>FITS : <a
href="http://fits.gsfc.nasa.gov/samples/WFPC2u5780205r_c0fx.fits"
title="sample source url">sample source</a></td>
<td>image/fits, application/fits</td>
<td>.fits, .fit, .fts</td>
<td>Flexible Image Transport System</td>
<td>
<div class="thumbcontainer">
<a
href="http://localhost:8090/ViewImage.png?url=WFPC2u5780205r_c0fx.fits"
title="Render FITS sample in full size"> <img
src="http://localhost:8090/ViewImage.png?maxwidth=128&maxheight=128&quadratic&url=WFPC2u5780205r_c0fx.fits"
width="128" height="128" alt="FITS render failed" />
</a>
</div>
</td>
<td>
<div class="browserthumb">
<a
href="http://localhost:8090/env/grafics/test/WFPC2u5780205r_c0fx.fits"
title="Render FITS sample in full size"> <img
src="http://localhost:8090/env/grafics/test/WFPC2u5780205r_c0fx.fits"
width="128" height="128" alt="FITS render failed" />
</a>
</div>
</td>
</tr>
<tr>
<td>JPEG 2000 : <a
href="http://www.fnordware.com/j2k/relax.jp2"
title="sample source url">sample source</a></td>
<td>image/jp2, image/jpx, image/jpm, video/mj2</td>
<td>.jp2, .j2k, .jpf, .jpx, .jpm, .mj2</td>
<td>JPEG 2000</td>
<td>
<div class="thumbcontainer">
<a href="http://localhost:8090/ViewImage.png?url=relax.jp2"
title="Render JPEG 2000 sample in full size"> <img
src="http://localhost:8090/ViewImage.png?maxwidth=128&maxheight=128&quadratic&url=relax.jp2"
width="128" height="128" alt="JPEG 2000 render failed" />
</a>
</div>
</td>
<td>
<div class="browserthumb">
<a href="http://localhost:8090/env/grafics/test/relax.jp2"
title="Render JPEG 2000 sample in full size"> <img
src="http://localhost:8090/env/grafics/test/relax.jp2"
width="128" height="128" alt="JPEG 2000 render failed" />
</a>
</div>
</td>
</tr>
<tr>
<td>KTX</td>
<td>image/ktx</td>
<td>.ktx</td>
<td>KTX (format for storing textures for OpenGL and OpenGL ES
applications)</td>
<td>
<div class="thumbcontainer">No Sample</div>
</td>
<td>
<div class="browserthumb">No Sample</div>
</td>
</tr>
<tr>
<td>NAPLPDS</td>
<td>image/naplps</td>
<td>not known</td>
<td>North American Presentation Layer Protocol Syntax</td>
<td>
<div class="thumbcontainer">No Sample</div>
</td>
<td>
<div class="browserthumb">No Sample</div>
</td>
</tr>
<tr>
<td>BTIF</td>
<td>image/prs.btif</td>
<td>.btif, .btf</td>
<td>Bank check images and ASCII text data, used by Nations Bank</td>
<td>
<div class="thumbcontainer">No Sample</div>
</td>
<td>
<div class="browserthumb">No Sample</div>
</td>
</tr>
<tr>
<td>PTI</td>
<td>image/prs.pti</td>
<td>.pti</td>
<td>PTI</td>
<td>
<div class="thumbcontainer">No Sample</div>
</td>
<td>
<div class="browserthumb">No Sample</div>
</td>
</tr>
<tr>
<td>PWG Raster</td>
<td>image/pwg-raster</td>
<td>none</td>
<td>Used for printing "raw" image data in formats acceptable to
printers</td>
<td>
<div class="thumbcontainer">No Sample</div>
</td>
<td>
<div class="browserthumb">No Sample</div>
</td>
</tr>
<tr>
<td>T38</td>
<td>image/t38</td>
<td>none</td>
<td>Only used for T.38 media stream in SDP</td>
<td>
<div class="thumbcontainer">No Sample</div>
</td>
<td>
<div class="browserthumb">No Sample</div>
</td>
</tr>
<tr>
<td>PSD</td>
<td>image/vnd.adobe.photoshop</td>
<td>.psd</td>
<td>Adobe Photoshop file</td>
<td>
<div class="thumbcontainer">No Sample</div>
</td>
<td>
<div class="browserthumb">No Sample</div>
</td>
</tr>
<tr>
<td>AZV</td>
<td>image/vnd.airzip.accelerator.azv</td>
<td>.azv</td>
<td>AirZip file</td>
<td>
<div class="thumbcontainer">No Sample</div>
</td>
<td>
<div class="browserthumb">No Sample</div>
</td>
</tr>
</tbody>
</table>
</body>
</html>

Binary file not shown.

After

Width:  |  Height:  |  Size: 81 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 213 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 MiB

@ -0,0 +1,51 @@
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="100%" height="100%" viewBox="0 0 100 100">
<title>SVG Logo</title>
<a xlink:href="http://www.w3.org/Graphics/SVG/" target="_parent" xlink:title="W3C SVG Working Group home page">
<rect id="background" fill="#FF9900" width="100" height="100" rx="4" ry="4"/>
<rect id="top-left" fill="#FFB13B" width="50" height="50" rx="4" ry="4"/>
<rect id="bottom-right" x="50" y="50" fill="#DE8500" width="50" height="50" rx="4" ry="4"/>
<g id="circles" fill="#FF9900">
<circle id="n" cx="50" cy="18.4" r="18.4"/>
<circle id="ne" cx="72.4" cy="27.6" r="18.4"/>
<circle id="e" cx="81.6" cy="50" r="18.4"/>
<circle id="se" cx="72.4" cy="72.4" r="18.4"/>
<circle id="s" cx="50" cy="81.6" r="18.4"/>
<circle id="sw" cx="27.6" cy="72.4" r="18.4"/>
<circle id="w" cx="18.4" cy="50" r="18.4"/>
<circle id="nw" cx="27.6" cy="27.6" r="18.4"/>
</g>
<g id="stars">
<path id="black-star" d="M 63.086, 18.385 c 0.000, -7.227 -5.859,-13.086 -13.100,-13.086 c -7.235, 0.000 -13.096, 5.859 -13.096, 13.086 c -5.100, -5.110 -13.395, -5.110 -18.497, 0.000 c -5.119, 5.120 -5.119, 13.408 0.000, 18.524 c -7.234, 0.000 -13.103, 5.859 -13.103, 13.085 c 0.000, 7.230 5.870, 13.098 13.103, 13.098 c -5.119, 5.110 -5.119, 13.395 0.000, 18.515 c 5.102, 5.104 13.397, 5.104 18.497, 0.000 c 0.000, 7.228 5.860, 13.083 13.096, 13.083 c 7.240, 0.000 13.100, -5.855 13.100,-13.083 c 5.118, 5.104 13.416, 5.104 18.513, 0.000 c 5.101, -5.120 5.101,-13.410 0.000,-18.515 c 7.216, 0.000 13.081, -5.869 13.081,-13.098 c 0.000, -7.227 -5.865,-13.085 -13.081,-13.085 c 5.101, -5.119 5.101,-13.406 0.000,-18.524 C 76.502, 13.275 68.206, 13.275 63.086, 18.385 z"/>
<path id="white-star" fill="#FFFFFF" d="M 55.003, 23.405 v 14.488 L 65.260, 27.640 c 0.000, -1.812 0.691,-3.618 2.066, -5.005 c 2.780, -2.771 7.275,-2.771 10.024, 0.000 c 2.771, 2.766 2.771, 7.255 0.000, 10.027 c -1.377, 1.375 -3.195, 2.072 -5.015, 2.072 L 62.101, 44.982 H 76.590 c 1.290, -1.280 3.054,-2.076 5.011, -2.076 c 3.900, 0.000 7.078, 3.179 7.078, 7.087 c 0.000, 3.906 -3.178, 7.088 -7.078, 7.088 c -1.957, 0.000 -3.721,-0.798 -5.011, -2.072 H 62.100 l 10.229, 10.244 c 1.824, 0.000 3.642, 0.694 5.015, 2.086 c 2.774, 2.759 2.774, 7.250 0.000, 10.010 c -2.750, 2.774 -7.239, 2.774 -10.025, 0.000 c -1.372, -1.372 -2.064,-3.192 -2.064, -5.003 L 55.000, 62.094 v 14.499 c 1.271, 1.276 2.084, 3.054 2.084, 5.013 c 0.000, 3.906 -3.177, 7.077 -7.098, 7.077 c -3.919, 0.000 -7.094,-3.167 -7.094, -7.077 c 0.000, -1.959 0.811,-3.732 2.081, -5.013 V 62.094 L 34.738, 72.346 c 0.000, 1.812 -0.705, 3.627 -2.084, 5.003 c -2.769, 2.772 -7.251, 2.772 -10.024, 0.000 c -2.775, -2.764 -2.775,-7.253 0.000,-10.012 c 1.377, -1.390 3.214,-2.086 5.012, -2.086 l 10.257,-10.242 H 23.414 c -1.289, 1.276 -3.072, 2.072 -5.015, 2.072 c -3.917, 0.000 -7.096,-3.180 -7.096, -7.088 s 3.177, -7.087 7.096,-7.087 c 1.940, 0.000 3.725, 0.796 5.015, 2.076 h 14.488 L 27.646, 34.736 c -1.797, 0.000 -3.632,-0.697 -5.012, -2.071 c -2.775, -2.772 -2.775,-7.260 0.000,-10.027 c 2.773, -2.771 7.256,-2.771 10.027, 0.000 c 1.375, 1.386 2.083, 3.195 2.083, 5.005 l 10.235, 10.252 V 23.407 c -1.270, -1.287 -2.082,-3.053 -2.082, -5.023 c 0.000, -3.908 3.175,-7.079 7.096, -7.079 c 3.919, 0.000 7.097, 3.168 7.097, 7.079 C 57.088, 20.356 56.274,22.119 55.003, 23.405 z"/>
</g>
<g id="svg-textbox">
<path id="text-backdrop" fill="black" d="M 5.30,50.00 H 94.68 V 90.00 Q 94.68,95.00 89.68,95.00 H 10.30 Q 5.30,95.00 5.30,90.00 Z"/>
<path id="shine" fill="#3F3F3F" d="M 14.657,54.211 h 71.394 c 2.908, 0.000 5.312, 2.385 5.312, 5.315 v 17.910 c -27.584,-3.403 -54.926,-8.125 -82.011,-7.683 V 59.526 C 9.353,56.596 11.743,54.211 14.657,54.211 L 14.657,54.211 z"/>
<g id="svg-text">
<title>SVG</title>
<path id="S" fill="#FFFFFF" stroke="#000000" stroke-width="0.5035" d="M 18.312,72.927 c -2.103,-2.107 -3.407, -5.028 -3.407, -8.253 c 0.000,-6.445 5.223,-11.672 11.666,-11.672 c 6.446, 0.000 11.667, 5.225 11.667, 11.672 h -6.832 c 0.000,-2.674 -2.168, -4.837 -4.835, -4.837 c -2.663, 0.000 -4.838, 2.163 -4.838, 4.837 c 0.000, 1.338 0.549, 2.536 1.415, 3.420 l 0.000, 0.000 c 0.883, 0.874 2.101, 1.405 3.423, 1.405 v 0.012 c 3.232, 0.000 6.145, 1.309 8.243, 3.416 l 0.000, 0.000 c 2.118, 2.111 3.424, 5.034 3.424, 8.248 c 0.000, 6.454 -5.221, 11.680 -11.667, 11.680 c -6.442, 0.000 -11.666, -5.222 -11.666,-11.680 h 6.828 c 0.000, 2.679 2.175, 4.835 4.838, 4.835 c 2.667, 0.000 4.835, -2.156 4.835, -4.835 c 0.000,-1.329 -0.545, -2.527 -1.429, -3.407 l 0.000, 0.000 c -0.864,-0.880 -2.082, -1.418 -3.406, -1.418 l 0.000, 0.000 C 23.341,76.350 20.429, 75.036 18.312, 72.927 L 18.312,72.927 L 18.312,72.927 z"/>
<polygon id="V" fill="#FFFFFF" stroke="#000000" stroke-width="0.5035" points="61.588,53.005 53.344,92.854 46.494,92.854 38.236,53.005 45.082,53.005 49.920,76.342 54.755,53.005"/>
<path id="G" fill="#FFFFFF" stroke="#000000" stroke-width="0.5035" d="M 73.255,69.513 h 11.683 v 11.664 l 0.000, 0.000 c 0.000, 6.452 -5.226,11.678 -11.669, 11.678 c -6.441, 0.000 -11.666,-5.226 -11.666,-11.678 l 0.000, 0.000 V 64.676 h -0.017 C 61.586,58.229 66.827,53.000 73.253, 53.000 c 6.459, 0.000 11.683, 5.225 11.683, 11.676 h -6.849 c 0.000,-2.674 -2.152,-4.837 -4.834, -4.837 c -2.647, 0.000 -4.820, 2.163 -4.820, 4.837 v 16.501 l 0.000, 0.000 c 0.000, 2.675 2.173, 4.837 4.820, 4.837 c 2.682, 0.000 4.834,-2.162 4.834, -4.827 v -0.012 v -4.827 h -4.834 L 73.255,69.513 L 73.255,69.513 z"/>
</g>
</g>
</a>
</svg>

After

Width:  |  Height:  |  Size: 7.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 28 KiB

File diff suppressed because one or more lines are too long

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.7 KiB

Binary file not shown.

Binary file not shown.

After

Width:  |  Height:  |  Size: 385 KiB

Loading…
Cancel
Save