diff servlet/src/digilib/servlet/Scaler.java @ 147:bdd6789d21e0

Fix for sending images that need no scaling.
author robcast
date Fri, 22 Aug 2003 15:02:21 +0200
parents d76006c12e89
children 837a633a0407
line wrap: on
line diff
--- 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.");