# HG changeset patch # User robcast # Date 1061557341 -7200 # Node ID bdd6789d21e05132b16f3af6a62e34b070655005 # Parent acfcafefe5b716f914340e072a13fa80fa91deaf Fix for sending images that need no scaling. diff -r acfcafefe5b7 -r bdd6789d21e0 servlet/src/digilib/io/DocuFileset.java --- 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; } } diff -r acfcafefe5b7 -r bdd6789d21e0 servlet/src/digilib/servlet/Scaler.java --- 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.");