Signature

yuleane

New Member
I try to make my own Signature Generator but have some problems...any suggestions are appreciated...can anybody check my code and let me know mistakes? Thanks alot!
Juls :rolleyes:

Code:
<?php
$nick = joedubs;
$sivu = file_get_contents("http://combatarms.nexon.net/Community/Profile.aspx?user=".$nick);
$stats_regex = "/\<dd\>.*\<\/dd\>/";
$stats2_regex = "/\<span\>.*\<\/span\>/";
$rankimg_regex = "/http:\/\/caimage\.nexon\.com\/Rank\/.*\.gif/";
preg_match_all($stats_regex, $sivu, $stats);
preg_match_all($stats2_regex, $sivu, $stats2);
preg_match($rankimg_regex, $sivu, $rankimg_raw);
$im = imagecreatefrompng("sig01.png");
$textcolor = imagecolorallocate($im, 0, 0, 0);
$font = "aliee13.ttf";
$rankicon = imagecreatefromgif("$rankimg_raw[0]");
imagecopy($im, $rankicon, 315, 5, 0, 0, imagesx($rankicon), imagesy($rankicon));
imagedestroy($rankicon);
imagettftext($im, 20, 0, 95, 38, $textcolor, $font, "$nick");
imagettftext($im, 15, 0, 180, 100, $textcolor, $font, substr(strip_tags($stats[0][2]), 0));
imagettftext($im, 15, 0, 180, 130, $textcolor, $font, substr(strip_tags($stats2[0][0]), 0));
header("Content-Type: image/png");
imagepng($im);
imagedestroy($im);
?>
 
Werbung:

illspirit

New Member
Code:
<?php

//CA IGN
$caign = "ingamename";

//Base Image for sig
$baseimage = "bgs/bg.png";

//Fonts to display in
$namefont = "fonts/ill.skillz.[fontvir.us].ttf";
$killfont = "fonts/arial.ttf";
$deathfont = "fonts/arial.ttf";
$fragfont = "fonts/arial.ttf";
$headfont = "fonts/arial.ttf";
$winfont = "fonts/arial.ttf";
$lossfont = "fonts/arial.ttf";
$streakfont = "fonts/arial.ttf";
$multifont = "fonts/arial.ttf";
$ultrafont = "fonts/arial.ttf";

//Font sizes
$namefontsize = "15";

//Font angles
$nameangle = "0";

//Font coordinates
$namex = "5";
$namey = "15";

//Font rgb colors
$namer = "255";
$nameg = "0";
$nameb = "0";

//Stat title definitions
$cakillname = "Kills:";
$cadeathname = "Deaths:";
$cafragname = "KDR:";
$caheadname = "HS:";
$cawinname = "Wins:";
$calossname = "Loss:";
$castreakname = "Streak:";
$camultiname = "Multis:";
$caultraname = "Ultras:";

//Pull the stats
$castats = file("http://combatarms.nexon.net/Community/Profile.aspx?user=$caign");
foreach($castats as $linenum => $line){}

//Base Image
$image = imagecreatefrompng("$baseimage");

//Fix to remove code and extra characters
$old_pattern = array("/[^a-zA-Z0-9]/", "/_+/", "/_$/"); 
$new_pattern = array("", "", "");

//Fix to check if line #s are correct
$canamecheck = strip_tags($castats[116]);
$canamecheck = preg_replace($old_pattern, $new_pattern , $canamecheck);

$nameline = "138";
$killline = "167";
$deathline = "171";
$headline = "175";
$winline = "183";
$lossline = "187";
$streakline = "203";
$multiline = "338";
$ultraline = "342";
/*
if($canamecheck == "$caign"){
//Content Line #s
$nameline = "116";
$killline = "138";
$deathline = "142";
$headline = "146";
$winline = "154";
$lossline = "158";
$streakline = "174";
$multiline = "309";
$ultraline = "313";
}
else{
$nameline = "124";
$killline = "153";
$deathline = "157";
$headline = "161";
$winline = "169";
$lossline = "173";
$streakline = "189";
$multiline = "324";
$ultraline = "328";
}
*/

//CA Name
$caname = strip_tags($castats[$nameline]);
$caname = preg_replace($old_pattern, $new_pattern , $caname);
$canamecolor  = ImageColorAllocate ($image, $namer, $nameg, $nameb);
imagettftext($image, $namefontsize, $nameangle, $namex, $namey, $canamecolor, $namefont, $caname);

//CA Kills
$cakills = strip_tags($castats[$killline]);
$cakills = preg_replace($old_pattern, $new_pattern , $cakills);
$cakillscolor  = ImageColorAllocate ($image, 255, 255, 255);
imagettftext($image, 10, 0, 5, 30, $cakillscolor, $killfont, $cakillname);
imagettftext($image, 10, 0, 35, 30, $cakillscolor, $killfont, $cakills);

//CA Deaths
$cadeaths = strip_tags($castats[$deathline]);
$cadeaths = preg_replace($old_pattern, $new_pattern , $cadeaths);
$cadeathscolor  = ImageColorAllocate ($image, 255, 255, 255);
imagettftext($image, 10, 0, 5, 45, $cadeathscolor, $deathfont, $cadeathname);
imagettftext($image, 10, 0, 53, 45, $cadeathscolor, $deathfont, $cadeaths);

//CA Frag
//if(($cakills > "0") AND ($cadeaths > "0")){
$cafrag = $cakills / $cadeaths;
$decimalcheck = substr_count($cafrag, '.');
if($decimalcheck > "0"){
$cafrag = round($cafrag, 2);
}else{$cafrag = $cafrag;}
$cafragcolor  = ImageColorAllocate ($image, 255, 255, 255);
imagettftext($image, 10, 0, 5, 60, $cafragcolor, $fragfont, $cafragname);
imagettftext($image, 10, 0, 37, 60, $cafragcolor, $fragfont, $cafrag);
//}

//CA Head
$cahead = strip_tags($castats[$headline]);
$cahead = preg_replace($old_pattern, $new_pattern , $cahead);
$caheadcolor  = ImageColorAllocate ($image, 255, 255, 255);
imagettftext($image, 10, 0, 5, 75, $caheadcolor, $headfont, $caheadname);
imagettftext($image, 10, 0, 28, 75, $caheadcolor, $headfont, $cahead);

//CA Wins
$cawins = strip_tags($castats[$winline]);
$cawins = preg_replace($old_pattern, $new_pattern , $cawins);
$cawinscolor  = ImageColorAllocate ($image, 255, 255, 255);
imagettftext($image, 10, 0, 5, 90, $cawinscolor, $winfont, $cawinname);
imagettftext($image, 10, 0, 38, 90, $cawinscolor, $winfont, $cawins);

//CA Loss
$caloss = strip_tags($castats[$lossline]);
$caloss = preg_replace($old_pattern, $new_pattern , $caloss);
$calosscolor  = ImageColorAllocate ($image, 255, 255, 255);
imagettftext($image, 10, 0, 5, 105, $calosscolor, $lossfont, $calossname);
imagettftext($image, 10, 0, 38, 105, $calosscolor, $lossfont, $caloss);

//CA Streak
$castreak = strip_tags($castats[$streakline]);
$castreak = preg_replace($old_pattern, $new_pattern , $castreak);
$castreakcolor  = ImageColorAllocate ($image, 255, 255, 255);
imagettftext($image, 10, 0, 5, 120, $castreakcolor, $streakfont, $castreakname);
imagettftext($image, 10, 0, 48, 120, $castreakcolor, $streakfont, $castreak);

//CA Multi Kills
$camulti = strip_tags($castats[$multiline]);
$camulti = preg_replace($old_pattern, $new_pattern , $camulti);
$camulticolor  = ImageColorAllocate ($image, 255, 255, 255);
imagettftext($image, 10, 0, 100, 60, $camulticolor, $multifont, $camultiname);
imagettftext($image, 10, 0, 140, 60, $camulticolor, $multifont, $camulti);

//CA Ultra Kills
$caultra = strip_tags($castats[$ultraline]);
$caultra = preg_replace($old_pattern, $new_pattern , $caultra);
$caultracolor  = ImageColorAllocate ($image, 255, 255, 255);
imagettftext($image, 10, 0, 100, 75, $caultracolor, $ultrafont, $caultraname);
imagettftext($image, 10, 0, 140, 75, $caultracolor, $ultrafont, $caultra);


header("Content-type: image/png");
imagepng($image);
imagedestroy($image);

?>

The line numbers may be different from when I used to do dynamic signatures, but the code works. Just make sure to make a /bgs folder and a /fonts folder... for your backgrounds and fonts, obviously.
 

yuleane

New Member
Thank you so much...!!!!!!!!
I really appreciate it!

I really fucked up big time, this is not even comparable to my code :)
I am still kinda at the "Hello World" Stage in PHP..... so yea..but I am learning...!
 
Werbung:

pater100

New Member
Code:
<?php

//CA IGN
$caign = "ingamename";

//Base Image for sig
$baseimage = "bgs/bg.png";

//Fonts to display in
$namefont = "fonts/ill.skillz.[fontvir.us].ttf";
$killfont = "fonts/arial.ttf";
$deathfont = "fonts/arial.ttf";
$fragfont = "fonts/arial.ttf";
$headfont = "fonts/arial.ttf";
$winfont = "fonts/arial.ttf";
$lossfont = "fonts/arial.ttf";
$streakfont = "fonts/arial.ttf";
$multifont = "fonts/arial.ttf";
$ultrafont = "fonts/arial.ttf";

//Font sizes
$namefontsize = "15";

//Font angles
$nameangle = "0";

//Font coordinates
$namex = "5";
$namey = "15";

//Font rgb colors
$namer = "255";
$nameg = "0";
$nameb = "0";

//Stat title definitions
$cakillname = "Kills:";
$cadeathname = "Deaths:";
$cafragname = "KDR:";
$caheadname = "HS:";
$cawinname = "Wins:";
$calossname = "Loss:";
$castreakname = "Streak:";
$camultiname = "Multis:";
$caultraname = "Ultras:";

//Pull the stats
$castats = file("http://combatarms.nexon.net/Community/Profile.aspx?user=$caign");
foreach($castats as $linenum => $line){}

//Base Image
$image = imagecreatefrompng("$baseimage");

//Fix to remove code and extra characters
$old_pattern = array("/[^a-zA-Z0-9]/", "/_+/", "/_$/"); 
$new_pattern = array("", "", "");

//Fix to check if line #s are correct
$canamecheck = strip_tags($castats[116]);
$canamecheck = preg_replace($old_pattern, $new_pattern , $canamecheck);

$nameline = "138";
$killline = "167";
$deathline = "171";
$headline = "175";
$winline = "183";
$lossline = "187";
$streakline = "203";
$multiline = "338";
$ultraline = "342";
/*
if($canamecheck == "$caign"){
//Content Line #s
$nameline = "116";
$killline = "138";
$deathline = "142";
$headline = "146";
$winline = "154";
$lossline = "158";
$streakline = "174";
$multiline = "309";
$ultraline = "313";
}
else{
$nameline = "124";
$killline = "153";
$deathline = "157";
$headline = "161";
$winline = "169";
$lossline = "173";
$streakline = "189";
$multiline = "324";
$ultraline = "328";
}
*/

//CA Name
$caname = strip_tags($castats[$nameline]);
$caname = preg_replace($old_pattern, $new_pattern , $caname);
$canamecolor  = ImageColorAllocate ($image, $namer, $nameg, $nameb);
imagettftext($image, $namefontsize, $nameangle, $namex, $namey, $canamecolor, $namefont, $caname);

//CA Kills
$cakills = strip_tags($castats[$killline]);
$cakills = preg_replace($old_pattern, $new_pattern , $cakills);
$cakillscolor  = ImageColorAllocate ($image, 255, 255, 255);
imagettftext($image, 10, 0, 5, 30, $cakillscolor, $killfont, $cakillname);
imagettftext($image, 10, 0, 35, 30, $cakillscolor, $killfont, $cakills);

//CA Deaths
$cadeaths = strip_tags($castats[$deathline]);
$cadeaths = preg_replace($old_pattern, $new_pattern , $cadeaths);
$cadeathscolor  = ImageColorAllocate ($image, 255, 255, 255);
imagettftext($image, 10, 0, 5, 45, $cadeathscolor, $deathfont, $cadeathname);
imagettftext($image, 10, 0, 53, 45, $cadeathscolor, $deathfont, $cadeaths);

//CA Frag
//if(($cakills > "0") AND ($cadeaths > "0")){
$cafrag = $cakills / $cadeaths;
$decimalcheck = substr_count($cafrag, '.');
if($decimalcheck > "0"){
$cafrag = round($cafrag, 2);
}else{$cafrag = $cafrag;}
$cafragcolor  = ImageColorAllocate ($image, 255, 255, 255);
imagettftext($image, 10, 0, 5, 60, $cafragcolor, $fragfont, $cafragname);
imagettftext($image, 10, 0, 37, 60, $cafragcolor, $fragfont, $cafrag);
//}

//CA Head
$cahead = strip_tags($castats[$headline]);
$cahead = preg_replace($old_pattern, $new_pattern , $cahead);
$caheadcolor  = ImageColorAllocate ($image, 255, 255, 255);
imagettftext($image, 10, 0, 5, 75, $caheadcolor, $headfont, $caheadname);
imagettftext($image, 10, 0, 28, 75, $caheadcolor, $headfont, $cahead);

//CA Wins
$cawins = strip_tags($castats[$winline]);
$cawins = preg_replace($old_pattern, $new_pattern , $cawins);
$cawinscolor  = ImageColorAllocate ($image, 255, 255, 255);
imagettftext($image, 10, 0, 5, 90, $cawinscolor, $winfont, $cawinname);
imagettftext($image, 10, 0, 38, 90, $cawinscolor, $winfont, $cawins);

//CA Loss
$caloss = strip_tags($castats[$lossline]);
$caloss = preg_replace($old_pattern, $new_pattern , $caloss);
$calosscolor  = ImageColorAllocate ($image, 255, 255, 255);
imagettftext($image, 10, 0, 5, 105, $calosscolor, $lossfont, $calossname);
imagettftext($image, 10, 0, 38, 105, $calosscolor, $lossfont, $caloss);

//CA Streak
$castreak = strip_tags($castats[$streakline]);
$castreak = preg_replace($old_pattern, $new_pattern , $castreak);
$castreakcolor  = ImageColorAllocate ($image, 255, 255, 255);
imagettftext($image, 10, 0, 5, 120, $castreakcolor, $streakfont, $castreakname);
imagettftext($image, 10, 0, 48, 120, $castreakcolor, $streakfont, $castreak);

//CA Multi Kills
$camulti = strip_tags($castats[$multiline]);
$camulti = preg_replace($old_pattern, $new_pattern , $camulti);
$camulticolor  = ImageColorAllocate ($image, 255, 255, 255);
imagettftext($image, 10, 0, 100, 60, $camulticolor, $multifont, $camultiname);
imagettftext($image, 10, 0, 140, 60, $camulticolor, $multifont, $camulti);

//CA Ultra Kills
$caultra = strip_tags($castats[$ultraline]);
$caultra = preg_replace($old_pattern, $new_pattern , $caultra);
$caultracolor  = ImageColorAllocate ($image, 255, 255, 255);
imagettftext($image, 10, 0, 100, 75, $caultracolor, $ultrafont, $caultraname);
imagettftext($image, 10, 0, 140, 75, $caultracolor, $ultrafont, $caultra);


header("Content-type: image/png");
imagepng($image);
imagedestroy($image);

?>

The line numbers may be different from when I used to do dynamic signatures, but the code works. Just make sure to make a /bgs folder and a /fonts folder... for your backgrounds and fonts, obviously.

hi,

am from a Combat Arms Site in The europe region. and we want a sig generator too. and my question was of you can help us. as we heve the code how we can convert it to Combat Arms europe. and with our site name on it.

i hope you want to help us.

grtz pater100.
 
Top