Remove reduce from image permalinks. Add rotation.
[bookreader.git] / BookReaderIA / datanode / BookReaderImages.inc.php
index 9d2f45e..e8d3877 100644 (file)
@@ -54,15 +54,15 @@ class BookReaderImages
 
     // Keys in the image permalink urls, e.g. http://www.archive.org/download/itemid/page/cover_{keyval}_{keyval}.jpg
     public static $imageUrlKeys = array(
-        'r' => 'reduce',
+        //'r' => 'reduce',
         's' => 'scale',
         'region' => 'region',
         'tile' => 'tile',
         'w' => 'width',
-        'h' => 'height'
+        'h' => 'height',
+        'rotate' => 'rotate'
     );
     
-    
     // Paths to command-line tools
     var $exiftool = '/petabox/sw/books/exiftool/exiftool';
     var $kduExpand = '/petabox/sw/bin/kdu_expand';
@@ -177,10 +177,12 @@ class BookReaderImages
             'ext' => 'jpg',
         );
         
-        if ($pageInfo['reduce']) {
-            $requestEnv['reduce'] = $pageInfo['reduce'];
-        }
-        // $$$ handle scale, other sizes, rotation, etc
+        // remove non-passthrough keys from pageInfo
+        unset($pageInfo['type']);
+        unset($pageInfo['value']);
+        
+        // add pageinfo to request
+        $requestEnv = array_merge($pageInfo, $requestEnv);
 
         // Return image data - will check privs        
         $this->serveRequest($requestEnv);
@@ -280,7 +282,7 @@ class BookReaderImages
             if (!$scale) {
                 $scale = 1;
             }
-            if (array_key_exists($scale, $this->imageSizes)) {
+            if (array_key_exists($scale, self::$imageSizes)) {
                 $srcRatio = floatval($imageInfo['width']) / floatval($imageInfo['height']);
                 if ($srcRatio > 1) {
                     // wide
@@ -791,7 +793,7 @@ class BookReaderImages
         
         // Look for other known parts
         foreach ($parts as $part) {
-            if ( in_array($part, $imageSizes) ) {
+            if ( in_array($part, self::$imageSizes) ) {
                 $pageInfo['size'] = $part;
                 continue;
             }