首页 > php代码 > php 给GIF 缩略图实例代码

php 给GIF 缩略图实例代码

<?php
try
{
    /*** Read in the animated gif ***/
    $animation = new Imagick("animation.gif");
    /*** Loop through the frames ***/
    foreach ($animation as $frame)
    {
        /*** Thumbnail each frame ***/
        $frame->thumbnailImage(100, 100);
    
        /*** Set virtual canvas size to 100x100 ***/
        $frame->setImagePage(100, 100, 0, 0);
    }
    /*** Write image to disk. Notice writeImages instead of writeImage ***/
    $animation->writeImages("animation_thumbnail.gif");
    echo "Images written";
}
catch(Exception $e)
{
    echo $e->getMessage();
}
?>


文章链接:http://www.phprm.com/code/63a5d833f6a4de35e862fccf38ce0bd5.html

随便收藏,请保留本文地址!

标签:none

发表留言