1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

XF 1.2 Animated Image scaling bug

Discussion in 'XenForo Questions and Support' started by Visteras, Jul 24, 2013.

  1. Visteras

    Visteras Member

  2. Jeremy

    Jeremy XenForo Moderator Staff 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?
     
  3. Visteras

    Visteras Member

    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.
     
  4. Visteras

    Visteras Member

    ImageMagick library must use an extra key when working with GIF images.
    See below:
    PHP:
    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 :)
     
  5. Mike

    Mike XenForo Developer Staff Member

    That code isn't relevant. We don't use ImageMagick via the command line.
     
  6. Visteras

    Visteras Member

    How's that option?
    PHP:
    $image = new Imagick('myfile.gif');
    $image $image->coalesceimages();

    $final = new \Imagick();
    foreach (
    $image as $frame){
        
    $image->thumbnailImage($width$heighttrue);
        
    $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->addimage($canvas);
    }
    $final $final->optimizedImageLayers();
    $final->writeImages('resized.gif'true);
     

Share This Page