كود PHP:
	
<?php
//include "vsys.php";
//include "gifmerge.php";
$tmp_save_prefix="";
$anim_size["h"]=50;
$anim_size["w"]=350;
/*if ($_POST["first_image2"])    {
    $fname= "fronts/".$_POST['first_image2'];
    $fname_real=$_POST['first_image2'];
}else{
    //$fname= $_FILES['first_image']['tmp_name'];
    $fname_real= $_FILES['first_image']['name'];
    //$fname="tmp/".time()."_".$fname_real;
    $fname=time()."_".$fname_real;
    move_uploaded_file($_FILES['first_image']['tmp_name'], $fname);
}
if ($_POST["second_image2"]){
    $fname2= "backs/".$_POST['second_image2'];
    $fname2_real=$_POST['second_image2'];
}else{
    $fname2_real= $_FILES['second_image']['name'];
    //$fname2="tmp/".time()."_".$fname2_real;
    $fname2=time()."_".$fname2_real;
    move_uploaded_file($_FILES['second_image']['tmp_name'], $fname2);
    //$fname2= $_FILES['second_image']['tmp_name'];
    
}
*/
//if (!$fname){vMessage("You should choose first image.");exit;}
//if (!$fname2){vMessage("You should choose second image.");exit;}
//$_POST['first_delay']=100;
//if (!$_POST['first_delay']){vMessage("You should choose delay for the first image.");exit;}
//if (!$_POST['second_delay']){vMessage("You should choose delay for the second image.");exit;}
session_start();
if ($_SESSION['number1']){
    $txt=$_SESSION['number1'];
}else{
switch ($_SESSION['number']){
    case 1: $num='O-N-E';break;
    case 2: $num='T-W-O';break;
    case 3: $num='T-H-R-E-E';break;
    case 4: $num='F-O-U-R';break;
    case 5: $num='F-I-V-E';break;
    case 6: $num='S-I-X';break;
    case 7: $num='S-E-V-E-N';break;
    case 8: $num='E-I-G-H-T';break;
    case 9: $num='N-I-N-E';break;
    case 10: $num='T-E-N';break;
    case 11: $num='E-L-E-V-E-N';break;
    case 12: $num='T-W-E-L-V-E';break;
    case 13: $num='T-H-I-R-T-E-E-N';break;
    case 14: $num='F-O-U-R-T-E-E-N';break;
    case 15: $num='F-I-F-T-E-E-N';break;
    default: $num=$_SESSION['number'];
    
}
//$num='o-n-e';
$first=chr(rand(0x21,0x40));
$last=chr(rand(0x21,0x40));
$txt=$first.'-'.$num.'-'.$last;
}
vMakeImg($txt);
//vMakeImg($fname2,$fname2_real,"second");
//vMakeAnimGif();
exit;
function  vMakeImg($n){
    global $anim_size;
    $img=imagecreatetruecolor($anim_size["w"],$anim_size["h"]);
    $iconf['bgcolor']='00,00,255'; //$_POST[$n.'_backcolor'];
    $iconf['font']='fonts/arialbd.ttf';
    $iconf['text1']=$n;
    //$iconf['text2']=$_POST[$n.'_text2'];
    //$iconf['text3']=$_POST[$n.'_text3'];
    $iconf['textcolor']='255,255,255';//$_POST[$n.'_textcolor'];
    $iconf['textsize']=27;//$_POST[$n.'_size'];
    //if ($iconf['font'])
        vText($img,$iconf['font'],$iconf['text1'],$iconf['text2'],$iconf['text3'],$iconf['textcolor'],$anim_size["h"],$anim_size["w"],$iconf['textsize']);
    
    //while (imagecolorstotal($img)<256){
                //imagecolorallocate ($img,0,0,0);
    //}
    //Ending
    
    //$tmp_save_file=($tmp_save_prefix)?$tmp_save_prefix:"tmp/".time()."_".rand(100,999);
    //$tmp_save_file=($tmp_save_prefix)?$tmp_save_prefix:time()."_".rand(100,999);
    //if (!$tmp_save_prefix)$tmp_save_prefix=$tmp_save_file;
    //$tmp_save_file.="_$n.gif";
    
    //********************************************************************************Uncoment
    //echo $_POST['path'].$tmp_save_file."==";
    //imagegif ($img,$_POST['path'].$tmp_save_file);
    //imagegif ($img,$tmp_save_file);
    //********************************************************************************Comment
    //imagegif ($img,$n.".gif");
    //echo $tmp_save_file."111";
    //echo "hi";
    //imagepng ($img);
    imagejpeg($img);
    //imagepng ($img,$n.".png");
    
}
function vMakeAnimGif(){
    global $cgi,$tmp_save_prefix;
    
    $animPath=$tmp_save_prefix."_all.gif";
    $filePath1=$tmp_save_prefix."_first.gif";
    $filePath2=$tmp_save_prefix."_second.gif";
    
    $inFiles[0]=$filePath1;
    $inFiles[1]=$filePath2;
    //echo "doing....<br>";
    
    //vMergeToGif("out.gif",$inFiles,20,99999,2);
    
    vMergeToGif($animPath,$inFiles,$_POST['first_delay'],99999);//,-1,$_POST['first_delay']);
    //echo "done.";
    //$str="whirlgif -o $animPath -loop -time {$_POST['first_delay']} $filePath1 -time {$_POST['second_delay']} $filePath2";
    //echo $str;
    //system($str); 
    
    
    //********************************************************************************Uncomment
    //unlink($filePath1);
    //********************************************************************************Uncomment
    //unlink($filePath2);
    //********************************************************************************Uncomment
    //echo "<script>document.location='{$animPath}';</script><a href='{$animPath}'>download</a>";
    //aim:BuddyIcon?src=http://dollisland.com imagename.gif 
    //echo "--";
    echo "<table width=100% height=100% ><tr><td valign=middle align=center><a href=aim:BuddyIcon?src=http://dollisland.com/gif/$animPath ><img src='$animPath' border=0></a></td></tr></table>";
    //echo "++";
    vTrash();
    
}
function LoadJpeg ($imgname,$imgtype) {
    //echo $imgtype."--";
    if ($imgtype==2){
        $im = @imagecreatefromjpeg ($imgname);//  Attempt to open 
    }elseif($imgtype==1){
        $im = @imagecreatefromgif ($imgname);//  Attempt to open 
    }elseif($imgtype==3){
        $im = @imagecreatefrompng ($imgname);//  Attempt to open 
    }elseif($imgtype==4){
        echo $imgname;
        $im = @imagecreatefromwbmp ($imgname);//  Attempt to open 
    }
    else{ $imgtype=2;}
    
    if (!$im) { // See if it failed 
        //$im  = imagecreatetruecolor (150, 30); // Create a blank image 
        $im  = imagecreate (150, 30); // Create a blank image 
        $bgc = imagecolorallocate ($im, 255, 255, 255);
        $tc  = imagecolorallocate ($im, 0, 0, 0);
        imagefilledrectangle ($im, 0, 0, 150, 30, $bgc);
        // Output an errmsg 
        imagestring ($im, 1, 5, 5, "Error loading $imgname", $tc);
    }
    
    return $im;
}
function vMessage($str){
    echo "<table height=100% width=100%><tr><td align=center valign=middle>$str";
}
function vBasename ($str){
    $strA=split("[\]",$str);
    $str1=$strA[count($strA)-1];
    $strA=split("[/]",$str1);
    $str1=$strA[count($strA)-1];
    return $str1;
}
function vExtType($str){
    $tnameA=split("\.",$str);
    $t_ext=$tnameA[count ($tnameA)-1];
    $t_ext=strtolower($t_ext);
    if ($t_ext=="gif"){$imgtype=1;}
    elseif (($t_ext=="jpg")||($t_ext=="jpeg")){$imgtype=2;}
    elseif ($t_ext=="png"){$imgtype=3;}
    elseif ($t_ext=="bmp"){$imgtype=4;}
    else {$imgtype=0;}
    //echo $imgtype."#;#";
    return $imgtype;
}
function vTrash(){
    global $cgi;
    if ($dir = @opendir($_POST['path'])) {
        while (($file = readdir($dir)) !== false) {
            if ( ($file!='.')&&($file!='..')){
                //echo $file;
                $tnameA=split("_",$file);
                if (count ($tnameA)>1){
                    $time1=$tnameA[0];
                    $time2=time();
                    if (($time2-$time1)>180)unlink($file);    
                }
            }
        }
        closedir($dir);
    }
    exit;
}
function getTXTSize($font,$text,$koef,$max_height,$width){
    
    $TXT['prev_size']=0;
    $TXT['prev_width']=0;
    
    for ($i=3;$i<=$max_height*$koef;$i++){
        $tmp=imagettfbbox ( $i, 0, $font, $text);
        $TXT['size']=$i;
        $TXT['width']=$tmp[2]-$tmp[0];
        if ($TXT['width']>$width*$koef){
            $TXT['width']=$TXT['prev_width'];
            $TXT['size']=$TXT['prev_size'];
            break;
        }
        $TXT['prev_width']=$TXT['width'];
        $TXT['prev_size']=$TXT['size'];
    }
    return $TXT;
}
function vText(&$img,$font,$text1,$text2,$text3,$textcolor,$h,$w,$size){
    
    $koef=1;
    $max_height=$size;
    //echo "--$max_height--";
    $colorA=split(",",$textcolor);    
    //print_r ($colorA);
    $color=imagecolorclosest ($img, $colorA[0], $colorA[1], $colorA[2]);
    //$color=imagecolorexact ($img, $colorA[0], $colorA[1], $colorA[2]);
    if ($color=-1){
        //echo "Allocating";
        $color=imagecolorallocate    ($img, $colorA[0], $colorA[1], $colorA[2]);
    }
    //$color=imagecolorclosest  ($img, 255, 255, 255);
    
    $TXTsize1=getTXTSize($font,$text1,$koef,$max_height,$w-10);
    $TXTsize2=getTXTSize($font,$text2,$koef,$max_height,$w-10);
    $TXTsize3=getTXTSize($font,$text3,$koef,$max_height,$w-10);
    
    $x1=round(($w*$koef-$TXTsize1[width])/2);
    $x2=round(($w*$koef-$TXTsize2[width])/2);
    $x3=round(($w*$koef-$TXTsize3[width])/2);
    
    $y1=$TXTsize1['size']*$koef+5;
    $y2=$y1+$TXTsize2['size']*$koef+5;
    $y3=$y2+$TXTsize3['size']*$koef+5;
    //echo "text1=$text1.x1=$x1.y1=$y1.color=$color.font=$font";
    imagettftext ($img,$TXTsize1['size'],0,$x1, $y1, $color, $font, $text1);
    imagettftext ($img,$TXTsize1['size'],0,$x2, $y2, $color, $font, $text2);
    imagettftext ($img,$TXTsize1['size'],0,$x3, $y3, $color, $font, $text3);
}
function vText2(&$dst_img,$src_img,$font,$text,$koef,$max_height,$width,$X,$Y,$Angle,$Color){
    $fontfile=$font;
    $conf['HeadLine_Color']=split(",",$Color);
    $headTextColor=imagecolorallocate ($dst_img, $conf['HeadLine_Color'][0], $conf['HeadLine_Color'][1], $conf['HeadLine_Color'][2]);
    if ($Angle){$padding=$Y;}
    else{$padding=$X;}
    $TXTsize=getTXTSize($fontfile,$text,$koef,$max_height,$width-$padding);
    if ($Angle){
        $start_txt_x=round(($width*$koef+$TXTsize[width])/2);//+$padding*$koef;//-$conf['HeadLine_X']*$conf['CoverImage_Quality'];
    }else{
        $start_txt_x=round(($width*$koef-$TXTsize[width])/2);//+$padding*$koef;//-$conf['HeadLine_X']*$conf['CoverImage_Quality'];
    }
    if ($Angle){
        $y=$start_txt_x;
        $x=$X*$koef;
    }else{
        $x=$start_txt_x;
        $y=$Y*$koef;
    }
    imagettftext ($dst_img,$TXTsize[size],$Angle,$x, $y, $headTextColor, $fontfile, $text);
}
?>