tried to solve some problems with new picture viewer

git-svn-id: https://svn.berlios.de/svnroot/repos/yacy/trunk@2019 6c8d7289-2bf4-0310-a012-ef5d649a1542
pull/1/head
orbiter 19 years ago
parent 23cdf319be
commit 14d6e476c9

@ -76,9 +76,10 @@ public class ViewImage {
// create image
MediaTracker mediaTracker = new MediaTracker(new Container());
Image original = Toolkit.getDefaultToolkit().createImage(imgb);
mediaTracker.addImage(original, 0);
try {mediaTracker.waitForID(0);} catch (InterruptedException e) {}
Image original = Toolkit.getDefaultToolkit().createImage(imgb);
int handle = original.hashCode();
mediaTracker.addImage(original, handle);
try {mediaTracker.waitForID(handle);} catch (InterruptedException e) {}
boolean auth = ((String) header.get("CLIENTIP", "")).equals("localhost") || sb.verifyAuthentication(header, false); // handle access rights
if ((auth) && ((width == 0) || (height == 0)) && (maxwidth == 0) && (maxheight == 0)) return original;
@ -106,6 +107,10 @@ public class ViewImage {
}
}
// check for minimum values
width = Math.max(width, 1);
height = Math.max(height, 1);
// scale image
Image scaled = original.getScaledInstance(width, height, Image.SCALE_AREA_AVERAGING);
mediaTracker.addImage(scaled, 0);

@ -111,7 +111,7 @@ available for everyone. Then stay online to support crawls from other peers. Tha
#{results}#
<!-- link begin -->
<p style="border-bottom:1px #000 dashed; padding-bottom: 1em;">
<a href="/Bookmarks_p.html?edit=#[urlhash]#" onMouseover="document.plus_#[urlhexhash]#.src=picPlus.src" onMouseout="document.plus_#[urlhexhash]#.src=picEmpty.src">
<a href="/Bookmarks.html?edit=#[urlhash]#" onMouseover="document.plus_#[urlhexhash]#.src=picPlus.src" onMouseout="document.plus_#[urlhexhash]#.src=picEmpty.src">
<img src="/env/grafics/empty.gif" title="bookmark" alt="bookmark" name="plus_#[urlhexhash]#" border="0"></a>
<span class="ResultDescription">#[description]#</span><br>
<a href="#[delete]#" onMouseover="document.minus_#[urlhexhash]#.src=picMinus.src" onMouseout="document.minus_#[urlhexhash]#.src=picEmpty.src">
@ -119,7 +119,7 @@ available for everyone. Then stay online to support crawls from other peers. Tha
<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> | <a href="yacysearch.html?cat=image&url=#[url]#">Pictures</a>
<span class="ResultDateYBR">YBR-#[ybr]#</span> | <a href="ViewFile.html?urlHash=#[urlhash]#&words=#[words]#">Info</a> | <a href="yacysearch.html?cat=image&url=#[url]#&search=#[former]#">Pictures</a>
<br>
</p>
<!-- link end -->

@ -78,11 +78,7 @@ public class yacysearch {
boolean authenticated = sb.adminAuthenticated(header) >= 2;
int display = ((post == null) || (!authenticated)) ? 0 : post.getInt("display", 0);
boolean global = (post == null) ? true : post.get("resource", "global").equals("global");
final boolean indexDistributeGranted = sb.getConfig("allowDistributeIndex", "true").equals("true");
final boolean indexReceiveGranted = sb.getConfig("allowReceiveIndex", "true").equals("true");
if (!indexDistributeGranted || !indexReceiveGranted) { global = false; }
// case if no values are requested
final String referer = (String) header.get("Referer");
if (post == null || env == null) {
@ -134,6 +130,21 @@ public class yacysearch {
serverObjects prop = new serverObjects();
final int count = Integer.parseInt(post.get("count", "10"));
final String order = post.get("order", plasmaSearchPreOrder.canUseYBR() ? "YBR-Date-Quality" : "Date-Quality-YBR");
boolean global = (post == null) ? true : post.get("resource", "global").equals("global");
final boolean indexDistributeGranted = sb.getConfig("allowDistributeIndex", "true").equals("true");
final boolean indexReceiveGranted = sb.getConfig("allowReceiveIndex", "true").equals("true");
if (!indexDistributeGranted || !indexReceiveGranted) { global = false; }
final long searchtime = 1000 * Long.parseLong(post.get("time", "10"));
String urlmask = "";
if (post.containsKey("urlmask") && post.get("urlmask").equals("no")) {
urlmask = ".*";
} else {
urlmask = (post.containsKey("urlmaskfilter")) ? (String) post.get("urlmaskfilter") : ".*";
}
String prefer = post.get("prefer", ".*");
if (post.get("cat", "href").equals("href")) {
prop.put("type", 0); // set type of result: normal link list
@ -156,9 +167,7 @@ public class yacysearch {
}
// prepare search order
final String order = post.get("order", plasmaSearchPreOrder.canUseYBR() ? "YBR-Date-Quality" : "Date-Quality-YBR");
final int count = Integer.parseInt(post.get("count", "10"));
final long searchtime = 1000 * Long.parseLong(post.get("time", "10"));
final boolean yacyonline = ((yacyCore.seedDB != null) && (yacyCore.seedDB.mySeed != null) && (yacyCore.seedDB.mySeed.getAddress() != null));
String order1 = plasmaSearchRankingProfile.ORDER_DATE;
@ -173,13 +182,7 @@ public class yacysearch {
if (order.endsWith("YBR")) order3 = plasmaSearchRankingProfile.ORDER_YBR;
if (order.endsWith("Date")) order3 = plasmaSearchRankingProfile.ORDER_DATE;
if (order.endsWith("Quality")) order3 = plasmaSearchRankingProfile.ORDER_QUALITY;
String urlmask = "";
if (post.containsKey("urlmask") && post.get("urlmask").equals("no")) {
urlmask = ".*";
} else {
urlmask = (post.containsKey("urlmaskfilter")) ? (String) post.get("urlmaskfilter") : ".*";
}
// do the search
plasmaSearchQuery thisSearch = new plasmaSearchQuery(
query,
@ -296,16 +299,9 @@ public class yacysearch {
}
}
prop.put("former", post.get("search", ""));
prop.put("count", count);
prop.put("order", order);
prop.put("resource", (global) ? "global" : "local");
prop.put("time", searchtime / 1000);
prop.put("urlmaskfilter", urlmask);
prop.put("type", "0");
prop.put("cat", "href");
prop.put("depth", "0");
// adding some additional properties needed for the rss feed
String hostName = (String) header.get("Host", "localhost");
@ -340,13 +336,21 @@ public class yacysearch {
line++;
}
prop.put("type_results", line);
prop.put("cat", "image");
prop.put("type", 1); // set type of result: image list
prop.put("former", post.get("search", ""));
prop.put("cat", "href");
prop.put("depth", depth);
}
prop.put("former", post.get("search", ""));
prop.put("count", count);
prop.put("order", order);
prop.put("resource", (global) ? "global" : "local");
prop.put("time", searchtime / 1000);
prop.put("urlmaskfilter", urlmask);
prop.put("prefer", prefer);
prop.put("display", display);
// return rewrite properties
return prop;
}

@ -515,9 +515,11 @@ public final class httpdFileHandler extends httpdAbstractHandler implements http
String mimeType = mimeTable.getProperty(targetExt, "text/html");
// generate an byte array from the generated image
int width = i.getWidth(null);
int height = i.getHeight(null);
BufferedImage bi = new BufferedImage(width, height, BufferedImage.TYPE_INT_RGB);
bi.createGraphics().drawImage(i, 0, 0, width, height, null);
serverByteBuffer baos = new serverByteBuffer();
BufferedImage bi = new BufferedImage(i.getWidth(null), i.getHeight(null), BufferedImage.TYPE_INT_RGB);
bi.createGraphics().drawImage(i, 0, 0, i.getWidth(null), i.getHeight(null), null);
ImageIO.write(bi, targetExt, baos);
byte[] result = baos.toByteArray();

@ -1878,7 +1878,8 @@ public final class plasmaSwitchboard extends serverAbstractSwitch implements ser
prop.put("type_results_" + i + "_date", dateString(urlentry.moddate()));
prop.put("type_results_" + i + "_ybr", plasmaSearchPreOrder.ybr(urlentry.hash()));
prop.put("type_results_" + i + "_size", Long.toString(urlentry.size()));
prop.put("type_results_" + i + "_words",URLEncoder.encode(query.queryWords.toString(),"UTF-8"));
prop.put("type_results_" + i + "_words", URLEncoder.encode(query.queryWords.toString(),"UTF-8"));
prop.put("type_results_" + i + "_former", formerSearch);
// adding snippet if available
if (snippet.exists()) {
prop.put("type_results_" + i + "_snippet", 1);

Loading…
Cancel
Save