Adjust jpeg image compression (65% quality instead of 90%) to reduce download times...
authorMichael Ang <mang@archive.org>
Mon, 20 Jul 2009 16:04:43 +0000 (16:04 +0000)
committerMichael Ang <mang@archive.org>
Mon, 20 Jul 2009 16:04:43 +0000 (16:04 +0000)
GnuBookIA/datanode/GnuBookImages.php

index a412a06..cb9f05d 100644 (file)
@@ -47,8 +47,9 @@ if (isset($_REQUEST['ext'])) {
 
 $fileExt = strtolower(pathinfo($file, PATHINFO_EXTENSION));
 
-// Png conversion options
+// Image conversion options
 $pngOptions = '';
+$jpegOptions = '-quality 65';
 
 // The pbmreduce reduction factor produces an image with dimension 1/n
 // The kakadu reduction factor produceds an image with dimension 1/(2^n)
@@ -131,9 +132,9 @@ if ('jp2' == $fileExt) {
 // }
 
 if ('jpg' == $ext) {
-    $compressCmd = ' | pnmtojpeg -quality 90';
+    $compressCmd = ' | pnmtojpeg ' . $jpegOptions;
 } else if ('png' == $ext) {
-    $compressCmd = ' | pnmtopng $pngOptions';
+    $compressCmd = ' | pnmtopng ' . $pngOptions;
 }
 
 $cmd = $unzipCmd . $decompressCmd . $compressCmd;