$dirurl = "http://fasttreck.net/email/";
$picdir = "sg";
function read_from_file($file){
$fp=fopen($file,"r");
if(!$fp){
return(FALSE);
}
flock($fp,LOCK_SH);
$data=fread($fp,filesize($file));
fclose($fp);
return($data);
}
function hexrgb($hexstr, $rgb){ //
$int = hexdec(str_replace("#", '', $hexstr));
switch($rgb) {
case "r":
return 0xFF & $int >> 0x10;
break;
case "g":
return 0xFF & ($int >> 0x8);
break;
case "b":
return 0xFF & $int;
break;
default:
return array(
"r" => 0xFF & $int >> 0x10,
"g" => 0xFF & ($int >> 0x8),
"b" => 0xFF & $int
);
break;
}
}
if($_GET['start']=="5glive"){
$filename = "images/sample.png";
$type = 1;
}elseif($_GET['show']){
$picname = $_GET['show'];
$filename = $picdir."/".date("ymd",$picname)."/".$picname.".png";
$type = 2;
}elseif($_GET['down']){
$filename = $_GET['down'];
header("Content-type: command");
header("Content-Disposition: attachment; filename=gramik.pl_emaillogo.png");
readfile($picdir."/".date("ymd",$filename)."/".$filename.".png");
exit;
}elseif($_GET['mkpic']=="5glive"){
$username = trim($_GET['s']); //????
if(ereg("^[0-9a-zA-Z\_@.]*$",$username) && $username){
$host = $_GET['maillogo']; //??HOST
$srcUrl = "s_logo/".$host.".gif"; //Email??URL
$back_c = "#ffffff"; //????
$border_c = $_GET['bordercolor']; //????
$font_c = $_GET['color']; //????
$font_size = $_GET['size']; //????
$font_url = "s_font/".$_GET['mailfont'].".ttf"; //??URL
if($_GET['border']=="true") $is_border = 1; else $is_border = 0; //????? 0?? ?0?
if($host) $is_logo = 1; else $is_logo=0; //??????? 0?? ?0?
$srcWidth = 0;
$srcHeight = 0;
$str_pos = imagettfbbox($font_size,0,$font_url,$username);
$str_width = intval($str_pos[2]); //??????
$str_height = intval(str_replace("-","",$str_pos[5])); //??????
if($is_logo){
$origImg = ImageCreateFromGIF($srcUrl);
$srcWidth = intval(imagesx($origImg)); //Email????
$srcHeight = intval(imagesy($origImg)); //Email????
}
$newWidth = $str_width + 15 + $srcWidth; //LOGO???
$newHeight = ($srcHeight>$str_height) ? $srcHeight+2 : $str_height+8;
$image=imagecreatetruecolor($newWidth, $newHeight); //????
$back_color = hexrgb($back_c,rgb); //?????
$back = imagecolorallocate($image, $back_color['r'], $back_color['g'], $back_color['b']); //???? ??
imagefilledrectangle($image, 0, 0, $newWidth - 1, $newHeight - 1, $back); //????
if($is_border){
$border_color = hexrgb($border_c,rgb); //?????
$border = imagecolorallocate($image, $border_color['r'], $border_color['g'], $border_color['b']); //????
imagerectangle($image, 0, 0, $newWidth - 1, $newHeight - 1, $border); //???
}
if($is_logo){
$srcX = $str_width+10; //Email??X???
$srcY = ($newHeight - $srcHeight)/2; //Email??Y???
ImageCopy($image, $origImg, $srcX,$srcY,0,0,$srcWidth,$srcHeight); //?Email?????LOGO?
}
$font_color = hexrgb($font_c,rgb); //?????
$color = imagecolorallocate($image, $font_color['r'], $font_color['g'], $font_color['b']); //????
$str_x = $str_height+($newHeight-$str_height)/2;
if(!$is_logo) $str_x-=2; //??????
imagettftext($image, $font_size, 0, 6, $str_x, $color, $font_url, $username); //????????
//????
$filename = time();
$filedir = date("ymd",$filename);
if(!file_exists($picdir."/".$filedir)){ //????????????????
mkdir($picdir."/".$filedir);
}
header("Content-type: image/png");
imagepng($image,$picdir."/".$filedir."/".$filename.".png"); //????????????????
imagedestroy($image);
header("location: ?show=".$filename);
exit;
}elseif($username==""){
$filename = "images/taddyshen.png";
$type = 4;
}else{
$filename = "images/error.png";
$type = 4;
}
}else{
$filename = "images/error.png";
$type = 4;
}
?>
FastTreck.net email signature generator
if($type==1){ ?>
}elseif($type==2){ ?>
}elseif($type==3){ ?>
}else{ ?>
} ?>