Quote (Spartan)aS( @ Mon, Sep 22 2008, 01:32am)
make a background picture with the same length as ur sig which is 350px then you go to the codes in .php and change it to fit your new lil banner
exactly which codes are those? i made the background pic. smaller, but then it won't show "to lvl up:" i looked at all the codes yet i can't figure out which one it is...
<?php
Header ('Content-type: image/jpeg');
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');
// create the image from a background jpg
$image = imagecreatefrompng('bg.png');
$expbar_width = 60;
$expbar_height = 5;
// set some colours for future use
$white = imagecolorallocate($image, 255, 255, 255);
$green1 = imagecolorallocate($image, 0, 240, 0);
$green2 = imagecolorallocate($image, 0, 220, 0);
$green3 = imagecolorallocate($image, 0, 200, 0);
$red = imagecolorallocate($image, 0, 180, 0);
$yellow = imagecolorallocate($image, 255, 181, 53);
// set the background colour
// number or is top left pixel x, top left pixel y, bottom right pixel x, bottom right pixel y
// set the font and print text
$font = 'Arial';
$font2 = '/MTCORSVA.TTF';
// 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');
// load xml data in vars
// This is where you load your own info from the xml d2jsp gives. This is a PHP5 only command!
$data = simplexml_load_file('http://ladderslasher.d2jsp.org/xmlChar.php?i=156032');
$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;
$percent = calcExpPercent($exp);
$brpixelX = calcBrPixelX($exp,$expbar_width);
// Create an expbar with bg 'cool' color and the cover of your level in red.
//Example ; imagefilledrectangle(image, x1, y1, x2, y2, color);
ImageTTFText ($image, 11, 0, 5, 16, $white, $font2, "Ladder Slasher");
ImageTTFText ($image, 7, 0, 337, 11, $white, $font, "To level up:");
imagefilledrectangle($image, 330, 15, 390, 19, $white);
imagefilledrectangle($image, 330, 15, 330 + $brpixelX, 16, $green1);
imagefilledrectangle($image, 330, 16, 330 + $brpixelX, 17, $green2);
imagefilledrectangle($image, 330, 17, 330 + $brpixelX, 18, $green3);
imagefilledrectangle($image, 330, 18, 330 + $brpixelX, 19, $green4);
/******************************************************
* TEXT PART *
******************************************************/
//Example ; ImageTTFText ($image, textsize, angle, left, top, color, font, "text");
//show name
ImageTTFText ($image, 7, 0, 100, 10, $yellow, $font, "Name: ");
ImageTTFText ($image, 7, 0, 130, 10, $white, $font, $name);
//show class
ImageTTFText ($image, 7, 0, 100, 21, $yellow, $font, "Class: ");
ImageTTFText ($image, 7, 0, 130, 21, $white, $font, $class);
// show lvl
ImageTTFText ($image, 7, 0, 180, 10, $yellow, $font, "Level: ");
ImageTTFText ($image, 7, 0, 210, 10, $white, $font, $level);
// show kills
ImageTTFText ($image, 7, 0, 180, 21, $yellow, $font, "Kills: ");
ImageTTFText ($image, 7, 0, 210, 21, $white, $font, $kills);
// Show MQ attempts
ImageTTFText ($image, 7, 0, 250, 10, $yellow, $font, "MQ attempts: ");
ImageTTFText ($image, 7, 0, 315, 10, $white, $font, $mqattempts);
// Show MQ passed
ImageTTFText ($image, 7, 0, 250, 21, $yellow, $font, "MQ passes: ");
ImageTTFText ($image, 7, 0, 315, 21, $white, $font, $mqpasses);
// output and destroy
imagepng($image);
imagedestroy($image);
/***
* calculate the exp bar width.
***/
function calcBrPixelX($input,$xpbar_width)
{
$temp1 = fmod($input,1000000);
$temp1 = ($temp1/1000000);
$temp1 = $temp1 * $xpbar_width;
return (int)$temp1;
}
/***
* Calculate the percentage of level done
***/
function calcExpPercent($input)
{
$temp1 = fmod($input,1000000);
$temp1 = ($temp1/1000000);
$temp1 = $temp1 * 100;
return (int)$temp1;
}
?>