Bump version number
[bookreader.git] / GnuBookIA / datanode / GnuBookImages.php
index c8c7ddb..d1c8485 100644 (file)
@@ -47,9 +47,16 @@ if (isset($_REQUEST['ext'])) {
 
 $fileExt = strtolower(pathinfo($file, PATHINFO_EXTENSION));
 
+// Rotate is currently only supported for jp2 since it does not add server load
+$allowedRotations = array("0", "90", "180", "270");
+$rotate = $_REQUEST['rotate'];
+if ( !in_array($rotate, $allowedRotations) ) {
+    $rotate = "0";
+}
+
 // Image conversion options
 $pngOptions = '';
-$jpegOptions = '-quality 65';
+$jpegOptions = '-quality 75';
 
 // The pbmreduce reduction factor produces an image with dimension 1/n
 // The kakadu reduction factor produceds an image with dimension 1/(2^n)
@@ -104,10 +111,11 @@ $unzipCmd  = 'unzip -p ' .
         
 if ('jp2' == $fileExt) {
     $decompressCmd = 
-        " | /petabox/sw/bin/kdu_expand -no_seek -quiet -reduce $powReduce -i /dev/stdin -o " . $stdoutLink;
+        " | /petabox/sw/bin/kdu_expand -no_seek -quiet -reduce $powReduce -rotate $rotate -i /dev/stdin -o " . $stdoutLink;
     if ($decompressToBmp) {
         $decompressCmd .= ' | bmptopnm ';
     }
+    
 } else if ('tif' == $fileExt) {
     // We need to create a temporary file for tifftopnm since it cannot
     // work on a pipe (the file must be seekable).