1
0
mirror of https://github.com/vichan-devel/vichan.git synced 2024-11-24 07:30:10 +01:00

convert+gifscale didn't respect $config['thumb_keep_animation_frames']

This commit is contained in:
Michael Foster 2013-08-01 04:24:34 -04:00
parent 4851d4cabe
commit 22f3a95e0e
2 changed files with 7 additions and 5 deletions

View File

@ -412,9 +412,9 @@
// Thumbnail extension, empty for inherited (png recommended) // Thumbnail extension, empty for inherited (png recommended)
$config['thumb_ext'] = 'png'; $config['thumb_ext'] = 'png';
// EXPERIMENTAL:
// Maximum amount of frames to resize (more frames means more processing power). "1" means no animated thumbnails. // Maximum amount of frames to resize (more frames means more processing power). "1" means no animated thumbnails.
// Requires $config['thumb_ext'] to be 'gif' $config['imagick'] to be enabled. // Requires $config['thumb_ext'] to be 'gif' and $config['thumb_method'] to be 'imagick', 'convert', or 'convert+gifsicle'.
// Not respected by 'convert'; will just resize all frames if this is > 1.
$config['thumb_keep_animation_frames'] = 1; $config['thumb_keep_animation_frames'] = 1;
// Thumbnailing method: // Thumbnailing method:
@ -427,7 +427,6 @@
// - 'convert+gifsicle' Same as above, with the exception of using `gifsicle` (command line application) // - 'convert+gifsicle' Same as above, with the exception of using `gifsicle` (command line application)
// instead of `convert` for resizing gifs. It's faster and resulting animated gifs // instead of `convert` for resizing gifs. It's faster and resulting animated gifs
// have less artifacts than if resized with ImageMagick. // have less artifacts than if resized with ImageMagick.
$config['thumb_method'] = 'gd'; $config['thumb_method'] = 'gd';
// Strip EXIF metadata from JPEG files // Strip EXIF metadata from JPEG files

View File

@ -282,10 +282,13 @@ class ImageConvert extends ImageBase {
$quality = $config['thumb_quality'] * 10; $quality = $config['thumb_quality'] * 10;
$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->format == 'gif' && ($config['thumb_ext'] == 'gif' || $config['thumb_ext'] == '') && $config['thumb_keep_animation_frames'] > 1) {
if ($this->gifsicle) { if ($this->gifsicle) {
if (shell_exec("gifsicle --unoptimize -O2 --resize {$this->width}x{$this->height} < " . if (shell_exec("gifsicle --unoptimize -O2 --resize {$this->width}x{$this->height} < " .
escapeshellarg($this->src . '') . " > " . escapeshellarg($this->temp)) || !file_exists($this->temp)) escapeshellarg($this->src . '') . " \"#0-{$config['thumb_keep_animation_frames']}\" > " .
escapeshellarg($this->temp)) || !file_exists($this->temp))
error('Failed to resize image!'); error('Failed to resize image!');
} else { } else {
if (shell_exec("convert -background transparent -filter Point -sample {$this->width}x{$this->height} +antialias -quality {$quality} " . if (shell_exec("convert -background transparent -filter Point -sample {$this->width}x{$this->height} +antialias -quality {$quality} " .