Allow reduction factors down to 32. Reduces size of loaded images in 2up when zoomed...
authorMichael Ang <mang@archive.org>
Fri, 14 Aug 2009 22:18:32 +0000 (22:18 +0000)
committerMichael Ang <mang@archive.org>
Fri, 14 Aug 2009 22:18:32 +0000 (22:18 +0000)
GnuBookIA/datanode/GnuBookImages.php
GnuBookIA/datanode/GnuBookJSIA.php

index cb9f05d..c8c7ddb 100644 (file)
@@ -77,8 +77,14 @@ if (isset($_REQUEST['height'])) {
         $powReduce = 1;
     } else if (4 == $scale) {
         $powReduce = 2;
+    } else if (8 == $scale) {
+        $powReduce = 3;
+    } else if (16 == $scale) {
+        $powReduce = 4;
+    } else if (32 == $scale) {
+        $powReduce = 5;
     } else {
-        // $$$ why do we default to such a small scale?
+        // $$$ Leaving this in as default though I'm not sure why it is...
         $scale = 8;
         $powReduce = 3;
     }
index e17702d..250cd60 100755 (executable)
@@ -139,16 +139,22 @@ gb.getPageURI = function(index) {
     if (1==this.mode) {
         var url = 'http://'+this.server+'/GnuBook/GnuBookImages.php?zip='+this.zip+'&file='+file+'&scale='+this.reduce;
     } else {
-        var ratio = this.getPageHeight(index) / this.twoPageH;
+        var ratio = this.getPageHeight(index) / this.twoPage.height;
         var scale;
         // $$$ we make an assumption here that the scales are available pow2 (like kakadu)
         if (ratio <= 2) {
             scale = 1;
         } else if (ratio <= 4) {
             scale = 2;
-        } else {
+        } else if (ratio <= 8) {
             scale = 4;
-        }        
+        } else if (ratio <= 16) {
+            scale = 8;
+        } else  if (ratio <= 32) {
+            scale = 16;
+        } else {
+            scale = 32;
+        }
     
         var url = 'http://'+this.server+'/GnuBook/GnuBookImages.php?zip='+this.zip+'&file='+file+'&scale='+scale;