From 76101cad516915c008ee5ca5b6d6c45dc54a7e03 Mon Sep 17 00:00:00 2001 From: czaks Date: Sun, 4 Aug 2013 04:46:30 -0400 Subject: fix gifsicle issue connected with frame limit --- inc/image.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'inc/image.php') diff --git a/inc/image.php b/inc/image.php index 193e588e..1c865218 100644 --- a/inc/image.php +++ b/inc/image.php @@ -320,7 +320,7 @@ 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 (($error = shell_exec_error("gifsicle --unoptimize -O2 --resize {$this->width}x{$this->height} < " . + if (($error = shell_exec_error("gifsicle -w --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!', null, $error); -- cgit v1.3 From 33a07e9ee0103f51991020721eb4e059e0990942 Mon Sep 17 00:00:00 2001 From: Michael Foster Date: Sun, 4 Aug 2013 05:11:46 -0400 Subject: bug fix, wrong index --- inc/image.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'inc/image.php') diff --git a/inc/image.php b/inc/image.php index 1c865218..23558386 100644 --- a/inc/image.php +++ b/inc/image.php @@ -265,8 +265,8 @@ class ImageConvert extends ImageBase { } $size = $this->get_size($this->src, false); if ($size) { - $this->width = $size[1]; - $this->height = $size[2]; + $this->width = $size[0]; + $this->height = $size[1]; $this->image = true; } else { -- cgit v1.3 From a3cf56a7688d9f5063ac06e5bf8afac0a693f2f0 Mon Sep 17 00:00:00 2001 From: czaks Date: Sun, 4 Aug 2013 15:29:18 -0400 Subject: gifsicle: make it finally work --- inc/image.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'inc/image.php') diff --git a/inc/image.php b/inc/image.php index 23558386..b3c0e6b5 100644 --- a/inc/image.php +++ b/inc/image.php @@ -321,7 +321,7 @@ 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 (($error = shell_exec_error("gifsicle -w --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']}\" >/dev/null -o " . escapeshellarg($this->temp))) || !file_exists($this->temp)) error('Failed to resize image!', null, $error); } else { -- cgit v1.3 From acfda35648b5a3eac5607084b781c0ced8e0bc53 Mon Sep 17 00:00:00 2001 From: Michael Foster Date: Sun, 4 Aug 2013 16:32:36 -0400 Subject: gifsicle: redirect stdout to /dev/null but keep stderr going to stdout --- inc/functions.php | 5 +++-- inc/image.php | 4 ++-- 2 files changed, 5 insertions(+), 4 deletions(-) (limited to 'inc/image.php') diff --git a/inc/functions.php b/inc/functions.php index 82f047b5..01fdb18e 100644 --- a/inc/functions.php +++ b/inc/functions.php @@ -1939,13 +1939,14 @@ function DNS($host) { return $ip_addr; } -function shell_exec_error($command) { +function shell_exec_error($command, $suppress_stdout = false) { global $config, $debug; if ($config['debug']) $start = microtime(true); - $return = trim(shell_exec('PATH="' . escapeshellcmd($config['shell_path']) . ':$PATH";' . $command . ' 2>&1 && echo "TB_SUCCESS"')); + $return = trim(shell_exec('PATH="' . escapeshellcmd($config['shell_path']) . ':$PATH";' . + $command . ' 2>&1 ' . ($suppress_stdout ? '> /dev/null ' : '') . '&& echo "TB_SUCCESS"')); $return = preg_replace('/TB_SUCCESS$/', '', $return); if ($config['debug']) { diff --git a/inc/image.php b/inc/image.php index b3c0e6b5..920cf8f9 100644 --- a/inc/image.php +++ b/inc/image.php @@ -321,8 +321,8 @@ 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 (($error = shell_exec_error("gifsicle -w --unoptimize -O2 --resize {$this->width}x{$this->height} < " . - escapeshellarg($this->src . '') . " \"#0-{$config['thumb_keep_animation_frames']}\" >/dev/null -o " . - escapeshellarg($this->temp))) || !file_exists($this->temp)) + escapeshellarg($this->src . '') . " \"#0-{$config['thumb_keep_animation_frames']}\" -o " . + escapeshellarg($this->temp), true)) || !file_exists($this->temp)) error('Failed to resize image!', null, $error); } else { if ($config['convert_manual_orient'] && ($this->format == 'jpg' || $this->format == 'jpeg')) -- cgit v1.3