XF 1.2 Animated Image scaling bug


Well-known member
This is a bug in the ImageMagick or GD (I'm not sure which one you are using) and not XenForo. What image processor are you using?
I use the GD. ImageMagick not installed.
If you are sure that the case in the library then I apologize. Not even think to check it.
Be sure to check ImageMagick, thank you for your help.
ImageMagick library must use an extra key when working with GIF images.
See below:
function imageapi_imagemagick_image_resize(&$image, $width, $height) {

  $extra = '';
  if($image->info['mime_type'] == 'image/gif') {
    $extra = '-coalesce ';
  $image->ops[] = $extra . '-resize '. (int) $width .'x'. (int) $height .'!';
  $image->info['width'] = $width;
  $image->info['height'] = $height;
  return TRUE;
Note: This code is used in the system Drupal
I did not find this in the code XenForo.
Also, when operating with the library is converting animated GIF to IMG, which as I understand it should not be.

P.S. Sorry for my bad english :)
How's that option?
$image = new Imagick('myfile.gif');
$image = $image->coalesceimages();

$final = new \Imagick();
foreach ($image as $frame){
    $image->thumbnailImage($width, $height, true);
    $geometry = $image->getImageGeometry();
    $x = ( $width - $geometry['width'] ) / 2;
    $y = ( $height - $geometry['height'] ) / 2;
    $canvas = new \Imagick();
    $canvas->newImage( $width, $height, $background);
    $canvas->compositeImage( $image, \Imagick::COMPOSITE_OVER, $x, $y );
$final = $final->optimizedImageLayers();
$final->writeImages('resized.gif', true);