duanlu1793 2013-08-26 05:05
浏览 73

php ImageMagick gif resize保持动画

After upload, the gif is resized but the animation is lost. What am I doing wrong?

try
{
   $animation = new Imagick($this->image_filename);

   foreach ($animation as $frame)
   {
      $frame->thumbnailImage($width, $height);
      $frame->setImagePage($width, $height, 0, 0);
   }

   $animation->writeImages($this->image_filename, true);

   echo "<img src='".$this->image_filename."' />";

   $this->image = imagecreatefromgif($this->image_filename);
}
catch(Exception $e){ echo $e->getMessage(); }

No exception caught.

Array
(
    [versionNumber] => 1608
    [versionString] => ImageMagick 6.4.8 2011-03-20 Q16 OpenMP http://www.imagemagick.org
)
  • 写回答

2条回答 默认 最新

  • drfrvbq736383 2013-08-26 05:16
    关注

    Try this: http://www.php.net/manual/en/imagick.coalesceimages.php
    The first comment seems like what u need. And u should never mix GD2 library ("imagecreatefromgif") and Imagick.

    评论

报告相同问题?