thumb: decrease preferred quality to 85%
[minimedit.git] / thumb / index.php
index f15a180b1e8e89983eea66d5430f7ee7fc19e159..c65cab3dab9ea7ebb2227ded9e4a2b984b845d7e 100644 (file)
@@ -1,6 +1,4 @@
 <?php
-ob_clean();
-
 list ($size, $imgpath) = explode('/', ltrim($Args, '/'), 2);
 $imgpath = preg_replace('{^(?=[0-9]+/)}', 'data/', $imgpath, 1);
 
@@ -28,6 +26,7 @@ catch (Throwable $e) {
        exit;
 }
 
+header('Cache-Control: max-age=2628000');
 header('Content-type: '.mime_content_type($target));
 readfile($target);
 exit;
@@ -88,10 +87,12 @@ function mkthumb_exec($source, $target, $width, $height)
        }
        $cmd = implode(' ', array_map('escapeshellarg', [
                'convert',
+               '-delete', '1--1', # static
                '-trim',
-               '-background', 'white', '-layers', 'flatten',
+               '-background', 'white', '-layers', 'flatten', # opaque
+               '-interlace', 'plane', # progressive
                '-resize', "${width}x${height}",
-               '-quality', '90%',
+               '-quality', '85%',
                $source, "jpg:$target"
        ]));
        $return = shell_exec("$cmd 2>&1");