How To Make A Dynamic Ladder Slasher Stat SignatureSome basic infoThis is a guide basically flapmo's guide (located here:
https://forums.d2jsp.org/topic.php?t=22792192&f=272) but with a few improvements, updates, and added explanations.
Check your serverTo check if your server is able to support this type of signature it needs to have PHP5 or better installed, and it needs to have GD library installed.
In notepad++ (you can use notepad but notepad++ is highly recommended) create a file called info.php5. Paste the following code inside that file:
In the info.php5:
Code
<?php
info();
?>
Save & upload the file to a directory on your webserver.
In your browser, open the info.php5 file (address would look like this:
http://www.yourwebspace.com/DirectoryYouUploadedTheFileTo/info.php5)Look for this:
Quote
gd
GD Support enabled
GD Version bundled (2.0.34 compatible)
FreeType Support enabled
FreeType Linkage with freetype
FreeType Version 2.1.9
GIF Read Support enabled
GIF Create Support enabled
JPG Support enabled
PNG Support enabled
WBMP Support enabled
XBM Support enabled
Make sure that GD, and PNG support is enabled and ensure that the GD version is at least 2.0.01.
Help, it doesn't work!Try the same thing but this time name your file info.php and check again. Your server may not be able to read php5.
If one of these things is missing, please post your issue below and I will answer it so people aren't asking the same questions.
The code:Copy and paste everything contained within the code box below and save it into a file with a .png.php5 extension. The file would look like this: mysignaturename.png.php5 (it might look like mysignaturename.png and tell you that it is a php5 extension which is fine).
Code
<?php
Header ('Content-type: image/png');
Header('Cache-Control: no-store, no-cache, must-revalidate, post-check=0, pre-check=0');
Header('Expires: Thu, 19 Nov 1981 08:52:00 GMT');
Header('Pragma: no-cache');
/******************************************************
* BASICS *
******************************************************/
// create the image from a png image. Replace "yourimage.png" with the file name of the image you would like to use.
$image = imagecreatefrompng('yourimage.png');
// set some colors for future use. The values are RGB (red value, green value, blue value)
$color = imagecolorallocate($image, 242, 53, 249);
// set the font and print text (can use ttf or otf files)
$font = 'yourfont.ttf';
/******************************************************
* LOAD DATA *
******************************************************/
// Create an array for determining the class you play.
// In the XML this is saved as an int number, the conversion is shown below.
$class_name = array( -1 => 'None',
0 => 'Fighter',
1 => 'Barbarian',
2 => 'Rogue',
3 => 'Magician',
4 => 'Guardian',
5 => 'Samurai',
6 => 'Paladin',
7 => 'Monk',
8 => 'Ninja',
9 => 'Warlock',
10 => 'Headhunter',
11=> 'Alchemist');
// This is where you load your own info from the xml d2jsp gives. Replace "yourcharacterid" with
// your character id. Replace "yourguildid" with your guild id. Replace "YourD2JspName" with
// your D2JSP name (case sensitive).
$data = simplexml_load_file('http://ladderslasher.d2jsp.org/xmlChar.php?i=yourcharacterid');
$guild = simplexml_load_file('http://ladderslasher.d2jsp.org/xmlGuild.php?i=yourguildid');
$temp = explode(";",$data->cprof);
foreach ((array) $temp as $value) {
$temp2 = explode(",",$value);
$cprof[(int)$temp2[0]] = (int)$temp2[1];
}
$temp3 = explode(";",$data->wprof);
foreach ((array) $temp3 as $value) {
$temp4 = explode(",",$value);
$wprof[(int)$temp4[0]] = (int)$temp4[1];
}
$temp5 = explode(";",$data->sprof);
foreach ((array) $temp5 as $value) {
$temp6 = explode(",",$value);
$sprof[(int)$temp6[0]] = (int)$temp6[1];
}
$name = $data->name;
$kills = $data->kills;
$class = $class_name[(int)$data->classid];
$exp = $data->exp;
$level = $data->level;
$hpmax = $data->hpmax;
$mqpasses = $data->mqpasses;
$mqattempts = $data->mqattempts;
$exp = (int)$exp;
$gps = getMemberGps($guild, 'YourD2JspName')['gps'];
$sword = $wprof[0];
$club = $wprof[1];
$axe = $wprof[2];
$dagger = $wprof[3];
$staff = $wprof[4];
$longsword = $wprof[5];
$warhammer = $wprof[6];
$battleaxe = $wprof[7];
$spear = $wprof[8];
$polearm = $wprof[9];
$ice = $cprof[0];
$fire = $cprof[1];
$lightning = $cprof[2];
$wind = $cprof[3];
$earth = $cprof[4];
$wheal = $cprof[5];
$heal = $cprof[6];
$focus = $cprof[7];
$fishing = $sprof[0];
$cooking = $sprof[1];
$glyphing = $sprof[2];
$transmuting = $sprof[3];
$suffusencing = $sprof[4];
/******************************************************
* TEXT PART *
******************************************************/
// Example; ImageTTFText ($image, textsize, angle, right indent, down indent, color, font, "text");
// The angle is counted clockwise. The indents are counted by pixels.
// show name
ImageTTFText ($image, 15, 0, 250, 30, $color, $font, "Name: ");
ImageTTFText ($image, 14, 0, 315, 30, $color, $font, $name);
// show class
ImageTTFText ($image, 12, 0, 280, 55, $color, $font, "Class: ");
ImageTTFText ($image, 10, 0, 330, 55, $color, $font, $class);
// show lvl
ImageTTFText ($image, 12, 0, 265, 90, $color, $font, "Level: ");
ImageTTFText ($image, 10, 0, 330, 90, $color, $font, $level);
// show experience
ImageTTFText ($image, 12, 0, 240, 112, $color, $font, "Experience: ");
ImageTTFText ($image, 10, 0, 330, 112, $color, $font, $exp);
// show kills
ImageTTFText ($image, 12, 0, 275, 70, $color, $font, "Kills: ");
ImageTTFText ($image, 10, 0, 330, 70, $color, $font, $kills);
// show max hp
ImageTTFText ($image, 15, 0, 122, 57, $color, $font, "HP: ");
ImageTTFText ($image, 15, 0, 145, 57, $color, $font, $hpmax);
// show MQ passes and attempts
ImageTTFText ($image, 12, 0, 295, 100, $color, $font, "MQ's: ");
ImageTTFText ($image, 10, 0, 345, 100, $color, $font, $mqpasses."/".$mqattempts);
// Whatever words you might want to display
ImageTTFText ($image, 15, 0, 122, 82, $color, $font, "Whatever");
ImageTTFText ($image, 15, 0, 122, 95, $color, $font, "You Want");
// Show guild points
ImageTTFText ($image, 12, 0, 260, 140, $color, $font, "Guild GPs: ");
ImageTTFText ($image, 10, 0, 375, 140, $color, $font, $gps);
// Show proficiencies
ImageTTFText ($image, 8, 0, 15, 99, $color, $font, $sword); // sword
ImageTTFText ($image, 22, 0, 270, 125, $color, $font, $club); // club
ImageTTFText ($image, 10, 0, 7, 26, $color, $font, $axe); // axe
ImageTTFText ($image, 10, 0, 28, 26, $color, $font, $dagger); // dagger
ImageTTFText ($image, 8, 0, 270, 125, $color, $font, $staff); // staff
ImageTTFText ($image, 8, 0, 270, 125, $color, $font, $longsword); // longsword
ImageTTFText ($image, 8, 0, 270, 125, $color, $font, $warhammer); // warhammer
ImageTTFText ($image, 22, 0, 270, 125, $color, $font, $battleaxe); // battleaxe
ImageTTFText ($image, 22, 0, 270, 125, $color, $font, $spear); // spear
ImageTTFText ($image, 22, 0, 270, 125, $color, $font, $polearm); // polearm
ImageTTFText ($image, 10, 0, 54, 26, $color, $font, $ice); // ice
ImageTTFText ($image, 22, 0, 270, 125, $color, $font, $fire); // fire
ImageTTFText ($image, 22, 0, 270, 125, $color, $font, $lightning); // lightning
ImageTTFText ($image, 8, 0, 46, 139, $color, $font, $wind); // wind
ImageTTFText ($image, 10, 0, 80, 26, $color, $font, $earth); // earth
ImageTTFText ($image, 8, 0, 15, 79, $color, $font, $wheal); // wild heal
ImageTTFText ($image, 10, 0, 106, 26, $color, $font, $heal); // heal
ImageTTFText ($image, 22, 0, 270, 125, $color, $font, $focus); // focus heal
ImageTTFText ($image, 8, 0, 46, 79, $color, $font, $fishing); // fishing
ImageTTFText ($image, 8, 0, 15, 119, $color, $font, $cooking); // cooking
ImageTTFText ($image, 22, 0, 270, 125, $color, $font, $glyphing); // glyphing
ImageTTFText ($image, 8, 0, 46, 119, $color, $font, $transmuting); // transmuting
ImageTTFText ($image, 22, 0, 270, 125, $color, $font, $suffusencing); // suffusencing
// output and destroy
imagepng($image);
imagedestroy($image);
/******************************************************
* FUNCTIONS *
******************************************************/
/***
* Calculate member GPS
***/
function getMemberGps($guild, $name) {
foreach ($guild as $member) {
if (reset($member['name']) === $name) {
return reset($member);
}
}
return false;
}
?>
Just place "//" before the line of any stat you do not wish to display.
Getting everything on the server:As of now, you should have atleast three files:
1. yoursignature.png.php5
2. yourimage.png
3. yourfont.ttf (You can get these from any font sites. I use dafont.)
We need to create a fourth file named: .htaccess (no extension .txt behind it!). Within the file write:
Code
Options MultiViews
and save the file.
What this does is it tells the directory that the .htaccess file is saved to that files within the directory can be read in multiple ways.
Now, upload the following files into one directory:
1. mysignaturename.png.php5
2. .htaccess
3. yourimage.png
4. yourfont.ttf
Now you can reference your image by using the .png extension (or .png.php5 extension if wanted). So it would be on
http://www.yourwebspace.com/DirectoryYouUploadedFilesTo/mysignaturename.png.That's it!
Please, if you have any questions, feel free to post them below. I will answer them as soon as I can.
