Mercurial > hg > digilib-old
changeset 147:bdd6789d21e0
Fix for sending images that need no scaling.
author | robcast |
---|---|
date | Fri, 22 Aug 2003 15:02:21 +0200 |
parents | acfcafefe5b7 |
children | 837a633a0407 |
files | servlet/src/digilib/io/DocuFileset.java servlet/src/digilib/servlet/Scaler.java |
diffstat | 2 files changed, 15 insertions(+), 5 deletions(-) [+] |
line wrap: on
line diff
--- a/servlet/src/digilib/io/DocuFileset.java Wed Aug 20 00:25:37 2003 +0200 +++ b/servlet/src/digilib/io/DocuFileset.java Fri Aug 22 15:02:21 2003 +0200 @@ -114,7 +114,7 @@ /** Get the next bigger DocuFile than the given size. * - * Returns the DocuFile from the set that has a width and height + * Returns the DocuFile from the set that has a width or height * bigger or equal the given size. * Returns null if there isn't any bigger image. * Needs DocuInfo instance to checkFile(). @@ -130,7 +130,7 @@ f.check(info); } if ((f.getSize().getHeight() >= size.getHeight()) - && (f.getSize().getWidth() >= size.getWidth())) { + || (f.getSize().getWidth() >= size.getWidth())) { return f; } }
--- a/servlet/src/digilib/servlet/Scaler.java Wed Aug 20 00:25:37 2003 +0200 +++ b/servlet/src/digilib/servlet/Scaler.java Fri Aug 22 15:02:21 2003 +0200 @@ -58,7 +58,7 @@ public class Scaler extends HttpServlet { // digilib servlet version (for all components) - public static final String dlVersion = "1.12b6"; + public static final String dlVersion = "1.12b7"; // Utils instance with debuglevel Utils util; @@ -90,7 +90,10 @@ // Debuggin! //TCTool tctool = new TCTool(); - System.out.println("***** Digital Image Library Servlet (version "+dlVersion+") *****"); + System.out.println( + "***** Digital Image Library Servlet (version " + + dlVersion + + ") *****"); // get our ServletContext ServletContext context = config.getServletContext(); @@ -433,7 +436,8 @@ boolean imageSendable = mimetypeSendable && !imagoOptions; /* if not autoRes and image smaller than requested - * size then send as is. + * size then send as is. + * if autoRes and image has requested size then send as is. * if not autoScale and not scaleToFit nor cropToFit * then send as is (mo=file) */ @@ -441,6 +445,12 @@ && imageSendable && (fileToLoad.getSize().width <= expectedSourceSize.width) && (fileToLoad.getSize().height <= expectedSourceSize.height)) + || (autoRes + && ((fileToLoad.getSize().width == expectedSourceSize.width) + || (fileToLoad.getSize().height <= expectedSourceSize.height))) + || (autoRes + && ((fileToLoad.getSize().width <= expectedSourceSize.width) + || (fileToLoad.getSize().height == expectedSourceSize.height))) || (!autoRes && !scaleToFit && !cropToFit && !absoluteScale)) { util.dprintln(1, "Sending File as is.");