- public function onStartResizeImageFile(ImageFile $imagefile, $outpath, array $box) {
- // So far we only take over the resize for IMAGETYPE_GIF
- // (and only animated for gifs! (and only if we really want to resize the animation!))
- if ($imagefile->type == IMAGETYPE_GIF && $imagefile->animated && common_config('thumbnail', 'animated')) {
- $magick = new Imagick($imagefile->filepath);
- $magick = $magick->coalesceImages();
- $magick->setIteratorIndex(0);
- do {
- $magick->cropImage($box['w'], $box['h'], $box['x'], $box['y']);
- $magick->thumbnailImage($box['width'], $box['height']);
- $magick->setImagePage($box['width'], $box['height'], 0, 0);
- } while ($magick->nextImage());
- $magick = $magick->deconstructImages();
+ public function onStartResizeImageFile(ImageFile $imagefile, $outpath, array $box)
+ {
+ switch ($imagefile->mimetype) {
+ case 'image/gif':
+ // If GIF, then only for animated gifs! (and only if we really want to resize the animation!)
+ if ($imagefile->animated && common_config('thumbnail', 'animated')) {
+ return $this->resizeImageFileAnimatedGif($imagefile, $outpath, $box);
+ }
+ break;
+ }
+ return true;
+ }