summaryrefslogtreecommitdiff
path: root/inc/image.php
diff options
context:
space:
mode:
authorczaks <marcin@6irc.net>2013-08-03 19:05:25 -0400
committerczaks <marcin@6irc.net>2013-08-03 19:05:25 -0400
commita0855cdcf5634d64fbb1ba294b05c8365ce37338 (patch)
treefa1217beedf487c321405432ea746343ec6afcec /inc/image.php
parent7d5fef9ace3bba46de40604b04ea2dee1dac7cb3 (diff)
parenta3fbff225927469e68efc7ab31977736f34c7480 (diff)
Merge branch 'master' of https://github.com/savetheinternet/Tinyboard
Conflicts: inc/config.php inc/functions.php templates/generic_page.html templates/index.html
Diffstat (limited to 'inc/image.php')
-rw-r--r--inc/image.php28
1 files changed, 13 insertions, 15 deletions
diff --git a/inc/image.php b/inc/image.php
index 51db2f83..88f735dd 100644
--- a/inc/image.php
+++ b/inc/image.php
@@ -279,26 +279,24 @@ class ImageConvert extends ImageBase {
}
$this->temp = tempnam($config['tmp'], 'imagick');
-
- $quality = $config['thumb_quality'] * 10;
-
- $config['thumb_keep_animation_frames'] = (int) $config['thumb_keep_animation_frames'];
+
+ $config['thumb_keep_animation_frames'] = (int)$config['thumb_keep_animation_frames'];
if ($this->format == 'gif' && ($config['thumb_ext'] == 'gif' || $config['thumb_ext'] == '') && $config['thumb_keep_animation_frames'] > 1) {
if ($this->gifsicle) {
- if (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)) || !file_exists($this->temp))
- error('Failed to resize image!');
+ escapeshellarg($this->temp) . '2>&1 &&echo $?') !== '0') || !file_exists($this->temp))
+ error('Failed to resize image!', null, $error);
} else {
- if (shell_exec("convert -background transparent -filter Point -sample {$this->width}x{$this->height} +antialias -quality {$quality} " .
- escapeshellarg($this->src . '') . " " . escapeshellarg($this->temp)) || !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('Failed to resize image!', null, $error);
}
} else {
- if (shell_exec("convert -background transparent -flatten -filter Point -scale {$this->width}x{$this->height} +antialias -quality {$quality} " .
- escapeshellarg($this->src . '[0]') . " " . escapeshellarg($this->temp)) || !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('Failed to resize image!', null, $error);
}
}
}
@@ -309,7 +307,7 @@ class ImagePNG extends ImageBase {
}
public function to($src) {
global $config;
- imagepng($this->image, $src, $config['thumb_quality']);
+ imagepng($this->image, $src);
}
public function resize() {
$this->GD_create();
@@ -322,7 +320,7 @@ class ImagePNG extends ImageBase {
class ImageGIF extends ImageBase {
public function from() {
- $this->image = @imagecreatefromgif ($this->src);
+ $this->image = @imagecreatefromgif($this->src);
}
public function to($src) {
imagegif ($this->image, $src);