From be797d2a1773490de93e2f92a5f9c25763424ef5 Mon Sep 17 00:00:00 2001 From: Parziphal Date: Fri, 6 Dec 2013 14:02:47 -0500 Subject: [PATCH] fixed some GIF thumbnails resulting in "corrupt" images. in order to do this, Imagick::coalesceImages() is called if the image to process is gif and has frames. this method slows down things, but ensures a good thumbnail. --- lib/Moebooru/Resizer.php | 3 +++ 1 file changed, 3 insertions(+) diff --git a/lib/Moebooru/Resizer.php b/lib/Moebooru/Resizer.php index 497ab05..0827657 100755 --- a/lib/Moebooru/Resizer.php +++ b/lib/Moebooru/Resizer.php @@ -22,6 +22,9 @@ abstract class Resizer if (class_exists('Imagick', false)) { $image = new Imagick($read_path); + if ($file_ext == 'gif' && $image->getNumberImages()) { + $image = $image->coalesceImages()->current(); + } $image->cropImage($crop_width, $crop_height, $crop_left, $crop_top); $image->thumbnailImage($width, $height);