diff options
| author | Michael Foster <savetheinternet@tinyboard.org> | 2013-08-02 23:18:25 -0400 |
|---|---|---|
| committer | Michael Foster <savetheinternet@tinyboard.org> | 2013-08-02 23:18:25 -0400 |
| commit | 62f8ea4813092b42a2cd390a8358ce798d103f40 (patch) | |
| tree | a8fae755b81f2fc5dd2bea585b9c14b22c296834 /inc/image.php | |
| parent | 6ecda16be3a69b42ae6d6149e0eaa9578015a21a (diff) | |
Better command-line ImageMagick image processing
Diffstat (limited to 'inc/image.php')
| -rw-r--r-- | inc/image.php | 18 |
1 files changed, 9 insertions, 9 deletions
diff --git a/inc/image.php b/inc/image.php index e30c6919..141973ee 100644 --- a/inc/image.php +++ b/inc/image.php @@ -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->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->temp) . ';echo $?') !== '0') || !file_exists($this->temp)) - error('Failed to resize image!'); + escapeshellarg($this->temp) . '2>&1 &&echo $?') !== '0') || !file_exists($this->temp)) + error($error); } else { - if (trim(shell_exec('convert ' . sprintf($config['convert_args'], $this->width, $this->height) . ' ' . - escapeshellarg($this->src . '') . " " . escapeshellarg($this->temp)) . ';echo $?') !== '0' || !file_exists($this->temp)) - error('Failed to resize image!'); + if (trim($error = shell_exec('convert ' . sprintf($config['convert_args'], '', $this->width, $this->height) . ' ' . + escapeshellarg($this->src) . ' ' . escapeshellarg($this->temp) . ' 2>&1 &&echo $?')) !== '0' || !file_exists($this->temp)) + error($error); } } else { - if (trim(shell_exec('convert -flatten ' . sprintf($config['convert_args'], $this->width, $this->height) . ' ' . - escapeshellarg($this->src . '[0]') . " " . escapeshellarg($this->temp) . ';echo $?')) !== '0' || !file_exists($this->temp)) - error('Failed to resize image!'); + if (trim($error = shell_exec('convert ' . sprintf($config['convert_args'], '-flatten', $this->width, $this->height) . ' ' . + escapeshellarg($this->src . '[0]') . " " . escapeshellarg($this->temp) . ' 2>&1 &&echo $?')) !== '0' || !file_exists($this->temp)) + error($error); } } } |
