PHP uses the Php_imagick_st-q8.dll class library, the JPG images connected to generate animated GIF images, you need to download the Php_imagick_st-q8.dll, file, and configure php.ini file, enable Php_imagick_ St-q8.dll. The configuration method is as follows:
1. Put the downloaded Php_imagick_st-q8.dll file in the PHP default extension directory, i.e.: php/ext/directory;
2, open php.ini, in the extension area to join this trip, note that the front does not have ";"
Extension=php_imagick_st-q8.dll
3. Restart Apache or IIS.
4. PHP functions are as follows:
<?PHP//a sequence of pictures that defines a JPG$filelist=Array( ' 1.jpg ', ' 2.jpg ', ' 3.jpg ', ' 4.jpg ');$type= ' gif ';$num= 200;$qian= ' New_ ';$path= './gif/';$is= 1;//function to generate GIF picturesGet_img ($filelist,$type,$num,$qian,$path,$is);/** get_img picture merge, generate GIF dynamic * $filelist image array to merge * $type generated type * $num number of frames generated * $qian new filename prefix * $path keep path * $is preview*/functionGet_img ($filelist,$type,$num,$qian,$path,$is){ //Initialize class $animation=NewImagick ();//set the generated format $animation->setformat ($type); foreach($filelist as $file ){ $image=NewImagick (); $image->readimage ($file);//Merging Pictures $animation->addimage ($image);//Add to Object $animation->setimagedelay ($num);//set the number of picture frames unset($image);//clears the memory image and frees up memory } //The following two lines are used for debugging, whether the test generates a GIF picture//header ("Content-type:image/gif");//echo ($animation->getimagesblob ()); The generated GIF file name combination $images=$qian. Time(). ‘.‘ .$type; //create a GIF picture $animation->writeimages ($images,true ); //save GIF to a specified folder Copy($images,$path.$images); //whether to preview if($is) { Echo' A GIF image has been generated: '.$images. ' <br/> '; Echo"$path.$images. "'/>"; } Else { Echo' A GIF image has been generated: '.$images. ' <br/> '; } //Delete the original saved picture unlink($images);}?>
PHP uses JPG to generate animated GIF images based on Php_imagick_st-q8.dll