PHP code for GIF thumbnails

Source: Internet
Author: User

Note that you must use writeimages () instead of 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 ?>

 

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.