Login   Register  
PHP Classes
elePHPant
Icontem

File: decode_a_gif.php

Recommend this page to a friend!
Stumble It! Stumble It! Bookmark in del.icio.us Bookmark in del.icio.us
  Classes of László Zsidi  >  Animated GIF into images  >  decode_a_gif.php  >  Download  
File: decode_a_gif.php
Role: Example script
Content type: text/plain
Description: Example file
Class: Animated GIF into images
Split GIF animations into multiple images
Author: By
Last change: Updated the example script.
Date: 2009-07-03 10:21
Size: 480 bytes
 

Contents

Class file image Download
<?php
    
include_once ( str_replace('\\','/',dirname(__FILE__) ) ."/GIFDecoder.class.php" );

    
$animation 'gears.gif';

      
$gifDecoder = new GIFDecoder fread fopen $animation"rb" ), filesize $animation ) ) );

    
$i 1;
    foreach ( 
$gifDecoder -> GIFGetFrames ( ) as $frame ) {
        if ( 
$i 10 ) {
            
fwrite fopen "frames/frame0$i.gif" "wb" ), $frame );
        }
        else {
            
fwrite fopen "frames/frame$i.gif" "wb" ), $frame );
        }
        
$i++;
    }
?>