tried to upload but it doesnt work
uploading
1. myimg.png
2. .htaccess
3. text.png.php5
Code
<?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');
/******************************************************
* BASICS *
******************************************************/
// create the image from a background jpg
$image = imagecreatefrompng('lssigcleanlb2.png');
$grey = imagecolorallocate($image, 240, 240, 240);
// 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 = '/folkard_.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');
// 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=88646');
$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;
$strenght = $data->strength;
$dexterity = $data->dexterity;
$exp = (int)$exp;
$percent = calcExpPercent($exp);
$brpixelX = calcBrPixelX($exp,$expbar_width);
/******************************************************
* TEXT PART *
******************************************************/
//Example; ImageTTFText ($image, textsize, angle, right indent, down indent, color, font, "text");
//show class
ImageTTFText ($image, 11, 0, 136, 49, $grey, $font, $class);
// show lvl
ImageTTFText ($image, 10, 0, 186, 49, $grey, $font, "lvl ");
ImageTTFText ($image, 10, 0, 211, 49, $grey, $font, $level);
// show strength
ImageTTFText ($image, 10, 0, 143, 66, $grey, $font, "Str ");
ImageTTFText ($image, 10, 0, 176, 66, $grey, $font, $strenght);
// show dexterity
ImageTTFText ($image, 10, 0, 204, 66, $grey, $font, "Dex ");
ImageTTFText ($image, 10, 0, 236, 66, $grey, $font, $dexterity);
// show kills
ImageTTFText ($image, 10, 0, 312, 45, $grey, $font, "Kills ");
ImageTTFText ($image, 10, 0, 352, 45, $grey, $font, $kills);
// SHow MQ passen and attempts
ImageTTFText ($image, 10, 0, 151, 99, $grey, $font, "Master ");
ImageTTFText ($image, 10, 0, 165, 109, $grey, $font, "Quests ");
ImageTTFText ($image, 10, 0, 218, 102, $grey, $font, $mqpasses."/".$mqattempts);
// output and destroy
imagepng($image);
imagedestroy($image);
/******************************************************
* FUNCTIONS *
******************************************************/
/***
* calculate the exp bar width.
***/
function calcBrPixelX($input,$xpbar_width)
{
$temp1 = fmod($input,1000000);
$temp1 = ($temp1/1000000);
$temp1 = $temp1 * $xpbar_width;
$temp1 = $temp1 + 180;
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;
}
?>
in one directory
is there anything wrong?
This post was edited by erasko on Nov 21 2008 11:36am