diff servlet/src/digilib/servlet/Scaler.java @ 185:91f28e4fee8f

Servlet version 1.18b2 - added max-image-size parameter for digilib-config - small fixes for the removal of the digilib.Utils class
author robcast
date Tue, 25 Nov 2003 19:26:45 +0100
parents afe7ff98bb71
children 7bb273c51e88
line wrap: on
line diff
--- a/servlet/src/digilib/servlet/Scaler.java	Tue Nov 25 19:25:02 2003 +0100
+++ b/servlet/src/digilib/servlet/Scaler.java	Tue Nov 25 19:26:45 2003 +0100
@@ -59,7 +59,7 @@
 public class Scaler extends HttpServlet {
 
 	// digilib servlet version (for all components)
-	public static final String dlVersion = "1.18b1";
+	public static final String dlVersion = "1.18b2";
 
 	// logger for accounting requests
 	Logger accountlog = Logger.getLogger("account.request");
@@ -69,12 +69,8 @@
 	Logger authlog = Logger.getLogger("digilib.auth");
 	
 	
-	// FileOps instance
-	FileOps fileOp;
 	// AuthOps instance
 	AuthOps authOp;
-	// ServletOps instance
-	ServletOps servletOp;
 	// DocuDirCache instance
 	DocuDirCache dirCache;
 
@@ -314,6 +310,13 @@
 			scaleQual = 2;
 		}
 
+		// check with the maximum allowed size (if set)
+		int maxImgSize = dlConfig.getAsInt("max-image-size");
+		if (maxImgSize > 0) {
+			paramDW = (paramDW * paramWS > maxImgSize) ? (int)(maxImgSize / paramWS) : paramDW;
+			paramDH = (paramDH * paramWS > maxImgSize) ? (int)(maxImgSize / paramWS) : paramDH;
+		}
+		
 		//"big" try for all file/image actions
 		try {