changeset 347:a87e80bfbd47

Servlet version 1.5.7b - new max-waiting-threads parameter and handling - DocumentBean also gets real image sizes (for dlInfo-xml et al.)
author robcast
date Fri, 22 Apr 2005 19:16:41 +0200
parents 5275a132dbd1
children af55194647a6
files servlet/src/digilib/servlet/DocumentBean.java
diffstat 1 files changed, 18 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/servlet/src/digilib/servlet/DocumentBean.java	Fri Apr 22 19:16:41 2005 +0200
+++ b/servlet/src/digilib/servlet/DocumentBean.java	Fri Apr 22 19:16:41 2005 +0200
@@ -21,7 +21,7 @@
 
 package digilib.servlet;
 
-import java.util.*;
+import java.util.List;
 
 import javax.servlet.ServletConfig;
 import javax.servlet.ServletContext;
@@ -33,9 +33,12 @@
 
 import digilib.auth.AuthOpException;
 import digilib.auth.AuthOps;
+import digilib.image.ImageOps;
+import digilib.image.ImageSize;
 import digilib.io.DocuDirCache;
 import digilib.io.DocuDirectory;
 import digilib.io.FileOps;
+import digilib.io.ImageFile;
 import digilib.io.ImageFileset;
 
 public class DocumentBean {
@@ -202,8 +205,22 @@
 		// get number of pages in directory
 		DocuDirectory dd = dirCache.getDirectory(fn);
 		if (dd != null) {
+			// add pt
 			dlRequest.setValue("pt", dd.size());
 		}
+		// get original pixel size
+		ImageFile origfile = fileset.getBiggest();
+		// check image for size if mo=hires
+		if ((! origfile.isChecked())&&dlRequest.hasOption("mo", "hires")) {
+			logger.debug("pre-checking image!");
+			ImageOps.checkFile(origfile);
+		}
+		ImageSize pixsize = origfile.getSize();
+		if (pixsize != null) {
+			// add pixel size
+			dlRequest.setValue("img.pix_x", new Integer(pixsize.getWidth()));
+			dlRequest.setValue("img.pix_y", new Integer(pixsize.getHeight()));
+		}
 	}
 
 	/**