Better command-line ImageMagick image processing
This commit is contained in:
parent
6ecda16be3
commit
62f8ea4813
@ -492,9 +492,9 @@
|
|||||||
$config['thumb_method'] = 'gd';
|
$config['thumb_method'] = 'gd';
|
||||||
// $config['thumb_method'] = 'convert';
|
// $config['thumb_method'] = 'convert';
|
||||||
|
|
||||||
// Command-line options passed to ImageMagick when using `convert` for thumbnailing.
|
// Command-line options passed to ImageMagick when using `convert` for thumbnailing. Don't touch the
|
||||||
// http://www.imagemagick.org/ImageMagick-7.0.0/script/command-line-options.php
|
// placement of "%s" and "%d".
|
||||||
$config['convert_args'] = '-background transparent -filter Point -sample %dx%d +antialias -quality 50';
|
$config['convert_args'] = '-background transparent %s -strip -thumbnail %dx%d -quality 65';
|
||||||
|
|
||||||
// Strip EXIF metadata from JPEG files.
|
// Strip EXIF metadata from JPEG files.
|
||||||
$config['strip_exif'] = false;
|
$config['strip_exif'] = false;
|
||||||
|
@ -284,19 +284,19 @@ class ImageConvert extends ImageBase {
|
|||||||
|
|
||||||
if ($this->format == 'gif' && ($config['thumb_ext'] == 'gif' || $config['thumb_ext'] == '') && $config['thumb_keep_animation_frames'] > 1) {
|
if ($this->format == 'gif' && ($config['thumb_ext'] == 'gif' || $config['thumb_ext'] == '') && $config['thumb_keep_animation_frames'] > 1) {
|
||||||
if ($this->gifsicle) {
|
if ($this->gifsicle) {
|
||||||
if (trim(shell_exec("gifsicle --unoptimize -O2 --resize {$this->width}x{$this->height} < " .
|
if (trim($error = shell_exec("gifsicle --unoptimize -O2 --resize {$this->width}x{$this->height} < " .
|
||||||
escapeshellarg($this->src . '') . " \"#0-{$config['thumb_keep_animation_frames']}\" > " .
|
escapeshellarg($this->src . '') . " \"#0-{$config['thumb_keep_animation_frames']}\" > " .
|
||||||
escapeshellarg($this->temp) . ';echo $?') !== '0') || !file_exists($this->temp))
|
escapeshellarg($this->temp) . '2>&1 &&echo $?') !== '0') || !file_exists($this->temp))
|
||||||
error('Failed to resize image!');
|
error($error);
|
||||||
} else {
|
} else {
|
||||||
if (trim(shell_exec('convert ' . sprintf($config['convert_args'], $this->width, $this->height) . ' ' .
|
if (trim($error = shell_exec('convert ' . sprintf($config['convert_args'], '', $this->width, $this->height) . ' ' .
|
||||||
escapeshellarg($this->src . '') . " " . escapeshellarg($this->temp)) . ';echo $?') !== '0' || !file_exists($this->temp))
|
escapeshellarg($this->src) . ' ' . escapeshellarg($this->temp) . ' 2>&1 &&echo $?')) !== '0' || !file_exists($this->temp))
|
||||||
error('Failed to resize image!');
|
error($error);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if (trim(shell_exec('convert -flatten ' . sprintf($config['convert_args'], $this->width, $this->height) . ' ' .
|
if (trim($error = shell_exec('convert ' . sprintf($config['convert_args'], '-flatten', $this->width, $this->height) . ' ' .
|
||||||
escapeshellarg($this->src . '[0]') . " " . escapeshellarg($this->temp) . ';echo $?')) !== '0' || !file_exists($this->temp))
|
escapeshellarg($this->src . '[0]') . " " . escapeshellarg($this->temp) . ' 2>&1 &&echo $?')) !== '0' || !file_exists($this->temp))
|
||||||
error('Failed to resize image!');
|
error($error);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user