PHP 给GIF 缩略图实例代码

请注意使用writeImages()而不是writeImage()

 1 <?php
 2 try
 3 {
 4     // Read in the animated gif
 5     $animation = new Imagick("animation.gif");
 6     
 7     // Loop through the frames
 8     foreach ($animation as $frame)
 9     {
10         // Thumbnail each frame
11         $frame->thumbnailImage(100, 100);
12         
13         // Set virtual canvas size to 100x100
14         $frame->setImagePage(100, 100, 0, 0);
15     }
16     
17     // Write image to disk. Notice writeImages instead of writeImage
18     $animation->writeImages("animation_thumbnail.gif");
19     echo "Images written";
20 }
21 catch (Exception $e)
22 {
23     echo $e->getMessage();
24 }
25 ?>

 

posted @ 2013-02-20 13:35  TobyDev  阅读(274)  评论(0编辑  收藏  举报