Skip to content

Distributed Peer-to-Peer Web Search Engine and Intranet Search Appliance

added Picture button to search results

orbiter00e768b259c0
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
<img src="/env/grafics/empty.gif" title="delete" alt="delete" name="minus_#[urlhexhash]#" border="0"></a>
<span class="#(snippet)#snippetLoading::snippetLoaded#(/snippet)#" id="#[urlhash]#">#(snippet)#loading snippet ...::#[text]##(/snippet)#</span><br>
<img src="/env/grafics/empty.gif" border="0">&nbsp;<a id="url#[urlhash]#" href="#[url]#">#[urlname]#</a><br>
-<img src="/env/grafics/empty.gif"><span class="ResultDateYBR">&nbsp;#[date]#</span> | <span class="ResultDateYBR">YBR-#[ybr]#</span> | <a href="ViewFile.html?urlHash=#[urlhash]#&words=#[words]#">Info</a><br>
+<img src="/env/grafics/empty.gif"><span class="ResultDateYBR">&nbsp;#[date]#</span> |
+<span class="ResultDateYBR">YBR-#[ybr]#</span> | <a href="ViewFile.html?urlHash=#[urlhash]#&words=#[words]#">Info</a> | <a href="yacysearch.html?cat=image&url=#[url]">Pictures</a>
+<br>
</p>
<!-- link end -->
#{/results}#
@@ -147,7 +149,7 @@ You can enrich the search results by using the 'global' option; you must also sw
::
#{results}#
<p style="border-bottom:1px #000 dashed; padding-bottom: 1em;">
-<img src="/ViewImage.png?url=#[url]#" border="0">
+<a href="#[url]#"><img src="/ViewImage.png?maxwidth=64&maxheight=64&url=#[url]#" border="0"></a>
</p>
#{/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