> 7) & 0x1) { $gct = $packed & 3; $gct_size = 3 * pow(2,$gct+1); $header["global_color_table"] = substr($gif_data,13,$gct_size); } return $header; } function strip_gif_header($gif_data) { $without_header = ""; $header_len = 0; $header = get_gif_header($gif_data); foreach ($header as $k=>$v) $header_len += strlen($v); return substr($gif_data,$header_len,strlen($gif_data)-$header_len); } function get_gif_image_data($gif_data) { $no_header = strip_gif_header($gif_data); $no_header = substr($no_header,0,strlen($no_header)-1); return $no_header; } function get_gif_image_descriptor($image_data) { $header = array(); $header["image_separator"] = substr($image_data,0,1); $header["image_left_position"] = substr($image_data,1,2); $header["image_top_position"] = substr($image_data,3,2); $header["image_width"] = substr($image_data,5,2); $header["image_height"] = substr($image_data,7,2); $header["packed"] = substr($image_data,9,1); $packed = ord($header["packed"]); if (($packed >> 7) & 0x1) { $lct = $packed & 3; $lct_size = 3 * pow(2,$lct+1); $header["local_color_table"] = substr($image_data,10,$lct_size); } return $header; } function strip_gif_image_descriptor($imgdata) { $descriptor = get_gif_image_descriptor($imgdata); $len = 0; foreach ($descriptor as $k=>$v) $len += strlen($v); return substr($imgdata,$len,strlen($imgdata)-$len); } function make_gifanim($gifs) { $head0 = get_gif_header($gifs[0]); $head0["packed"] = chr( ord($head0["packed"]) & (7 << 4) ); $head0["background_color_index"] = chr(0); $head0["pixel_aspect_ratio"] = chr(0); unset($head0["global_color_table"]); $anim_gif = implode("",$head0); $extra_info = array( chr(0x21), chr(0xff) ,chr(0x0B), "NETSCAPE2.0",chr(0x03), chr(0x01), chr(0x00).chr(0x00), chr(0x00) ); $anim_gif .= implode("",$extra_info); foreach ($gifs as $gif) { $header = get_gif_header($gif); $imgdata = get_gif_image_data($gif); $image_header = get_gif_image_descriptor($imgdata); $image_only = strip_gif_image_descriptor($imgdata); $control_block = array(); $control_block["extension_introducer"] = chr(0x21); $control_block["graphic_control_label"] = chr(0xF9); $control_block["block_size"] = chr(4); $control_block["packed"] = chr(0); $control_block["delay"] = chr(50).chr(0); $control_block["transparent_color_index"] = chr(0); $control_block["terminator"] = chr(0); if (!isset($image_header["local_color_table"]) && isset($header["global_color_table"])) { $image_header["local_color_table"] = $header["global_color_table"]; $size_gct = (ord($header["packed"]) & 3); $image_header["packed"] = chr( ord($image_header["packed"]) | (0x1 << 7) | ($size_gct) ); } $anim_gif .= implode("",$control_block).implode("",$image_header).$image_only; } $anim_gif .= chr(0); return $anim_gif; } $tot_frames = 30; $anim_len = 10; $start_dummy = rand(0,10); $end_dummy = rand($start_dummy+$anim_len,30); $files = array(); $new_code = $code; $new_code_tmp = ""; for ($f=0;$f$start_dummy && $f<$end_dummy) for ($i=0;$i