note 64389 deleted from function.imagegif by bjori
| From: | bjori@php.net | Date: | Thu, 13 Apr 2006 11:22:22 +0000 |
| Subject: | note 64389 deleted from function.imagegif by bjori | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-107978@lists.php.net to get a copy of this message | ||
Note Submitter: zsidi dot laszlo at chello dot hu
----
Hi! Do you want to create animated gif from single gif frames with pure php code?
please, i rewrite '1998 Peter Kleiweg MergeGif 1.0d C version' into pure php version.
Part 1:
<?php
/*
(C) 2006 László Zsidi GifMerge 1.0
==================================
This program is a rewrite php port of
(C) 1998 Peter Kleiweg MergeGif 1.0d
C version.
*/
/*///////////////////////////////////////////////*/
/*// //*/
/*// G I F M E R G E . P H P //*/
/*// //*/
/*///////////////////////////////////////////////*/
/*///////////////////////////////////////////////*/
/*// V A R I A B L E S //*/
/*///////////////////////////////////////////////*/
$ver = "1.0";
/*///////////////////////////////////////////////*/
/*// B O O L E A N S //*/
/*///////////////////////////////////////////////*/
$first = true;
$debug = false;
$use_loop = false;
$transparent = false;
$use_global_in = false;
/*///////////////////////////////////////////////*/
/*// I N T E G E R S & C H A R S //*/
/*///////////////////////////////////////////////*/
$x = 0;
$y = 0;
$fin = 0;
$fout = '';
$delay = 50;
$width = 0;
$height = 0;
$trans1 = 255;
$trans2 = 255;
$trans3 = 255;
$disposal = 2;
$out_color_table_size = 0;
$local_color_table_flag = 0;
$global_color_table_size = 0;
$out_color_table_sizecode = 0;
$global_color_table_sizecode = 0;
/*///////////////////////////////////////////////*/
/*// A R R A Y S //*/
/*///////////////////////////////////////////////*/
$gif = array(0x47, 0x49, 0x46); // <= GIF
$buffer = array();
$local_in = array();
$global_in = array();
$global_out = array();
$logical_screen_descriptor = array();
$netscape = array(
0x21,
0xFF,
0x0B,
0x4e,
0x45,
0x54,
0x53,
0x43,
0x41,
0x50,
0x45,
0x32,
0x2e,
0x30,
0x03,
0x01,
0x00,
0x00,
0x00 );
/*///////////////////////////////////////////////*/
/*// F U N C T I O N S //*/
/*///////////////////////////////////////////////*/
/*///////////////////////////////////////////////*/
/*// Function :: gifmerge() //*/
/*///////////////////////////////////////////////*/
function gifmerge($images, $t1, $t2, $t3, $loop, $dl, $dp, $xpos, $ypos)
{
global $fout, $netscape, $debug, $original_dimensions, $disposal,
$use_loop, $transparent, $trans1, $trans2, $trans3, $delay, $x, $y;
if($debug) print "GifMerge debugger...\n<br>";
if($loop)
{
$netscape[16] = $loop & 255;
$netscape[17] = $loop >> 8;
$use_loop = true;
}
if($t1 && $t2 && $t3)
{
$trans1 = $t1;
$trans2 = $t2;
$trans3 = $t3;
$transparent = true;
}
if($dl)
{
$delay = $dl;
}
if($dp)
{
$disposal = $dp;
}
if($xpos)
{
$x = $xpos;
}
if($ypos)
{
$y = $ypos;
}
for($i = 0; $i < count($images); $i++)
{
start_gifmerge_process($images[$i]);
}
return $fout;
}