From 00e768b259c0ca5b5a814867c564b198c29355f4 Mon Sep 17 00:00:00 2001 From: orbiter Date: Fri, 7 Apr 2006 13:38:09 +0000 Subject: [PATCH] added Picture button to search results git-svn-id: https://svn.berlios.de/svnroot/repos/yacy/trunk@2011 6c8d7289-2bf4-0310-a012-ef5d649a1542 --- htroot/ViewImage.java | 28 +++++++++++++++++++++------- htroot/yacysearch.html | 6 ++++-- yacy.init | 16 ++++++++-------- 3 files changed, 33 insertions(+), 17 deletions(-) diff --git a/htroot/ViewImage.java b/htroot/ViewImage.java index 529235eaf..d88feb630 100644 --- a/htroot/ViewImage.java +++ b/htroot/ViewImage.java @@ -66,6 +66,8 @@ public class ViewImage { } int width = post.getInt("width", 0); int height = post.getInt("height", 0); + int maxwidth = post.getInt("maxwidth", 0); + int maxheight = post.getInt("maxheight", 0); int timeout = post.getInt("timeout", 5000); // load image @@ -78,17 +80,29 @@ public class ViewImage { mediaTracker.addImage(original, 0); try {mediaTracker.waitForID(0);} catch (InterruptedException e) {} boolean auth = ((String) header.get("CLIENTIP", "")).equals("localhost") || sb.verifyAuthentication(header, false); // handle access rights - if ((auth) && ((width == 0) || (height == 0))) return original; + if ((auth) && ((width == 0) || (height == 0)) && (maxwidth == 0) && (maxheight == 0)) return original; // in case of not-authorized access shrink the image to prevent copyright problems // so that images are not larger than thumbnails if (!auth) { - width = width / 2; - height = height / 2; - int xsc = Math.max(width, height); - if (xsc > 64) { - width = width * 64 / xsc; - height = height * 64 / xsc; + maxwidth = 64; + maxheight = 64; + } + + // calculate width & height from maxwidth & maxheight + if ((maxwidth != 0) || (maxheight != 0)) { + int h = original.getHeight(null); + int w = original.getWidth(null); + double hs = (w <= maxwidth) ? 1.0 : ((double) w) / ((double) maxwidth); + double vs = (h <= maxheight) ? 1.0 : ((double) h) / ((double) maxheight); + double scale = Math.max(hs, vs); + if ((scale > 1.0) && (!auth)) scale = 0.6; // this is for copyright purpose + if (scale > 1.0) { + width = (int) (((double) w) / scale); + height = (int) (((double) h) / scale); + } else { + width = w; + height = h; } } diff --git a/htroot/yacysearch.html b/htroot/yacysearch.html index 25627bdc9..3fdc2196c 100644 --- a/htroot/yacysearch.html +++ b/htroot/yacysearch.html @@ -118,7 +118,9 @@ available for everyone. Then stay online to support crawls from other peers. Tha delete #(snippet)#loading snippet ...::#[text]##(/snippet)#
 #[urlname]#
- #[date]# | YBR-#[ybr]# | Info
+ #[date]# | +YBR-#[ybr]# | Info | Pictures +

#{/results}# @@ -147,7 +149,7 @@ You can enrich the search results by using the 'global' option; you must also sw :: #{results}#

- +

#{/results}# #(/type)# diff --git a/yacy.init b/yacy.init index abe3e96d1..056da29d7 100644 --- a/yacy.init +++ b/yacy.init @@ -657,13 +657,13 @@ storagePeerHash = # time-percent is the percent of total search time # count-percent is the percent of total wanted urls in result # we distinguish local and remote search times -searchProcessLocalTime_c = 10 +searchProcessLocalTime_c = 44 searchProcessLocalCount_c = 10000000 -searchProcessLocalTime_j = 10 +searchProcessLocalTime_j = 8 searchProcessLocalCount_j = 1000000 -searchProcessLocalTime_r = 10 +searchProcessLocalTime_r = 8 searchProcessLocalCount_r =100000 -searchProcessLocalTime_u = 50 +searchProcessLocalTime_u = 20 searchProcessLocalCount_u = 10000 searchProcessLocalTime_o = 10 searchProcessLocalCount_o = 100 @@ -672,13 +672,13 @@ searchProcessLocalCount_f = 100 searchProcessLocalTime_s = 5 searchProcessLocalCount_s = 30 -searchProcessRemoteTime_c = 10 +searchProcessRemoteTime_c = 44 searchProcessRemoteCount_c = 1000000 -searchProcessRemoteTime_j = 10 +searchProcessRemoteTime_j = 8 searchProcessRemoteCount_j = 1000000 -searchProcessRemoteTime_r = 10 +searchProcessRemoteTime_r = 8 searchProcessRemoteCount_r = 1000 -searchProcessRemoteTime_u = 50 +searchProcessRemoteTime_u = 20 searchProcessRemoteCount_u = 1000 searchProcessRemoteTime_o = 10 searchProcessRemoteCount_o = 1000