Distributed Peer-to-Peer Web Search Engine and Intranet Search Appliance
Java decentralizedintranet-searchintranet-search-enginep2pp2p-networkprivacyprivacy-protectionsearch-enginesearchenginewebweb-search-enginewebsearchwebseearch-engine
fix appearance of image search thumbnails.
orbiterce1dbfeb0ffc
diff --git a/htroot/ViewImage.java b/htroot/ViewImage.javaindex d0e9b1271..b7fb2baba 100644--- a/htroot/ViewImage.java+++ b/htroot/ViewImage.java@@ -21,6 +21,7 @@// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USAimport java.awt.Container;+import java.awt.Graphics2D;import java.awt.Image;import java.awt.MediaTracker;import java.awt.image.BufferedImage;@@ -72,6 +73,7 @@ public class ViewImage {String urlString = post.get("url", "");final String urlLicense = post.get("code", "");+ final boolean quadratic = post.containsKey("quadratic");final boolean auth = Domains.isLocalhost(header.get(HeaderFramework.CONNECTION_PROP_CLIENTIP, "")) || sb.verifyAuthentication(header); // handle access rightsDigestURL url = null;@@ -146,6 +148,23 @@ public class ViewImage {// find original sizefinal int h = image.getHeight(null);final int w = image.getWidth(null);++ // if a quadratic flag is set, we cut the image out to be in quadratic shape+ if (quadratic && w != h) {+ 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;+ }+ }// in case of not-authorized access shrink the image to prevent// copyright problems, so that images are not larger than thumbnailsdiff --git a/htroot/yacysearchitem.html b/htroot/yacysearchitem.htmlindex 8f51dfc11..2f1a2b430 100644--- a/htroot/yacysearchitem.html+++ b/htroot/yacysearchitem.html@@ -37,9 +37,9 @@</div>::#(item)#::<div class="thumbcontainer">- <a href="#[hrefCache]#" target="#[target]#" class="thumblink" onclick="return hs.expand(this)">+ <a href="#[href]#" target="#[target]#" class="thumblink" onclick="return hs.expand(this)"><!-- <img src="ViewImage.png?maxwidth=128&maxheight=128&code=#[code]#" alt="#[name]#" /> -->- <img src="#[href]#" width="128" height="128" alt="#[name]#" />+ <img src="#[hrefCache]#" width="128" height="128" alt="#[name]#" /></a><div class="highslide-caption"><a href="#[href]#" target="#[target]#">#[name]#</a><br /><a href="#[source]#" target="#[target]#">#[sourcedom]#</a></div><!--diff --git a/htroot/yacysearchitem.java b/htroot/yacysearchitem.javaindex ae6d9b311..8465c7a98 100644--- a/htroot/yacysearchitem.java+++ b/htroot/yacysearchitem.java@@ -35,7 +35,6 @@ import net.yacy.cora.document.feed.RSSMessage;import net.yacy.cora.document.id.DigestURL;import net.yacy.cora.document.id.MultiProtocolURL;import net.yacy.cora.protocol.ClientIdentification;-import net.yacy.cora.protocol.Domains;import net.yacy.cora.protocol.HeaderFramework;import net.yacy.cora.protocol.RequestHeader;import net.yacy.cora.protocol.RequestHeader.FileType;@@ -62,7 +61,6 @@ import net.yacy.server.serverSwitch;import net.yacy.utils.crypt;import net.yacy.utils.nxTools;-public class yacysearchitem {private static final String SHORTEN_SUFFIX = "...";@@ -79,7 +77,6 @@ public class yacysearchitem {final String eventID = post.get("eventID", "");final boolean authenticated = sb.adminAuthenticated(header) >= 2;final int item = post.getInt("item", -1);- final boolean auth = Domains.isLocalhost(header.get(HeaderFramework.CONNECTION_PROP_CLIENTIP, "")) || sb.verifyAuthentication(header);final RequestHeader.FileType fileType = header.fileType();// default settings for blank item@@ -279,7 +276,7 @@ public class yacysearchitem {final String license = URLLicense.aquireLicense(image.imageUrl);sb.loader.loadIfNotExistBackground(image.imageUrl, 1024 * 1024 * 10, null, ClientIdentification.yacyIntranetCrawlerAgent);- prop.putHTML("content_item_hrefCache", (auth) ? "/ViewImage.png?url=" + imageUrlstring : imageUrlstring);+ prop.putHTML("content_item_hrefCache", "/ViewImage.png?maxwidth=128&maxheight=128&quadratic=&url=" + imageUrlstring);prop.putHTML("content_item_href", imageUrlstring);prop.putHTML("content_item_target", target);prop.put("content_item_code", license);