d2jsp
Log InRegister
d2jsp Forums > d2jsp > Ladder Slasher > Guide: How-to Make A Dynamic Ladder-slasher Sig > In A Few Easy Steps With Pics
Prev1515253545560Next
Add Reply New Topic New Poll
Member
Posts: 15,364
Joined: May 11 2003
Gold: 11,084.90
Aug 12 2009 01:31am
Quote (pu3ska @ Wed, Aug 12 2009, 12:25am)
can any1 tell me why the "Second(s) is not showing?"


I found the code on some random site.. seemed to work out ;)



Here is the code i used
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 background jpg
$image = imagecreatefrompng('bg.png');

// set some colours for future use
$cool  = imagecolorallocate($image, 81, 86, 96);
$red   = imagecolorallocate($image, 255, 0, 0);
$yellow = imagecolorallocate($image, 255, 181, 53);

// set the font and print text
$font = '/avqest.ttf';

/******************************************************
*                     LOAD DATA                      *
******************************************************/
$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=155121');
$name = $data->name;
$class = $class_name[(int)$data->classid];

$lastaction = (int)$data->lastaction;
$time1 = time() - $lastaction;
$lastplayed = duration($time1);


/******************************************************
*                     TEXT PART                      *
******************************************************/
//Example; ImageTTFText ($image, textsize, angle, right indent, down indent, color,

font, "text");

//show name
ImageTTFText ($image, 9, 0, 122, 33, $yellow, $font, "Name: ");
ImageTTFText ($image, 9, 0, 160, 33, $red, $font, $name);

//show class
ImageTTFText ($image, 9, 0, 280, 33, $yellow, $font, "Class: ");
ImageTTFText ($image, 9, 0, 320, 33, $red, $font, $class);

// Last Played
ImageTTFText ($image, 9, 0, 122, 45, $yellow, $font, "Last Played: ");
ImageTTFText ($image, 9, 0, 190, 45, $red, $font, $lastplayed);

// output and destroy
imagepng($image);
imagedestroy($image);


/******************************************************
*                     FUNCTIONS                      *
******************************************************/

/***
* Calculate the last played time.
***/
function duration($secs)
{
$vals = array('w' => (int) ($secs / 86400 / 7),
'd' => $secs / 86400 % 7,
'h' => $secs / 3600 % 24,
'm' => $secs / 60 % 60,
's' => $secs % 60);
$ret = array();
$added = false;
foreach ($vals as $k => $v) {
if ($v > 0 || $added) {
$added = true;
$ret[] = $v . $k;
}

}

return join(' ', $ret);
}

?>


Quote (Konqk @ Wed, Aug 12 2009, 03:23am)
http://konqk.hostei.com/ls/konqk/don.png

Guys look what error i get ......


Helping via AIM.

This post was edited by GimmeCoffee on Aug 12 2009 01:46am
Member
Posts: 14,202
Joined: May 14 2008
Gold: 2.85
Aug 12 2009 03:09am
How can i change exp bar's colour ?
Member
Posts: 14,202
Joined: May 14 2008
Gold: 2.85
Aug 12 2009 04:33am
Quote (Konqk @ Wed, 12 Aug 2009, 12:09)
How can i change exp bar's colour ?


Also how can i remove ex. The exp numbers to show ?
Member
Posts: 15,364
Joined: May 11 2003
Gold: 11,084.90
Aug 12 2009 12:00pm
Quote (Konqk @ Wed, Aug 12 2009, 05:09am)
How can i change exp bar's colour ?

You could use this to find a color that you might like.
http://www.cs.brown.edu/courses/cs092/VA10/HTML/ColorChooser.html

When you find a color.. take the R, G, B #'s and fill them into the code.

Example: $<name> = imagecolorallocate($image, R, G, B);
Code
$black   = imagecolorallocate($image, 0, 0, 0);
$magenta = imagecolorallocate($image, 255, 0, 150);


Now including the new color into the exp bar (using flapmo's guide)
Code
// Create an expbar with bg 'black' color and the cover of your level in magenta.
imagefilledrectangle($image, 180, 59, 280, 71, $black);
imagefilledrectangle($image, 180, 59, $brpixelX, 71, $magenta);
Member
Posts: 26,026
Joined: Jun 13 2007
Gold: 23.70
Aug 12 2009 04:02pm
Quote (GimmeCoffee @ Wed, Aug 12 2009, 03:31am)
I found the code on some random site.. seemed to work out ;)

http://freewaffles.hostoi.com/ls/test/lp2.png

Here is the code i used
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 background jpg
$image = imagecreatefrompng('bg.png');

// set some colours for future use
$cool  = imagecolorallocate($image, 81, 86, 96);
$red   = imagecolorallocate($image, 255, 0, 0);
$yellow = imagecolorallocate($image, 255, 181, 53);

// set the font and print text
$font = '/avqest.ttf';

/******************************************************
*                     LOAD DATA                      *
******************************************************/
$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=155121');
$name = $data->name;
$class = $class_name[(int)$data->classid];

$lastaction = (int)$data->lastaction;
$time1 = time() - $lastaction;
$lastplayed = duration($time1);


/******************************************************
*                     TEXT PART                      *
******************************************************/
//Example; ImageTTFText ($image, textsize, angle, right indent, down indent, color,

font, "text");

//show name
ImageTTFText ($image, 9, 0, 122, 33, $yellow, $font, "Name: ");
ImageTTFText ($image, 9, 0, 160, 33, $red, $font, $name);

//show class
ImageTTFText ($image, 9, 0, 280, 33, $yellow, $font, "Class: ");
ImageTTFText ($image, 9, 0, 320, 33, $red, $font, $class);

// Last Played
ImageTTFText ($image, 9, 0, 122, 45, $yellow, $font, "Last Played: ");
ImageTTFText ($image, 9, 0, 190, 45, $red, $font, $lastplayed);

// output and destroy
imagepng($image);
imagedestroy($image);


/******************************************************
*                     FUNCTIONS                      *
******************************************************/

/***
* Calculate the last played time.
***/
function duration($secs)
{
$vals = array('w' => (int) ($secs / 86400 / 7),
'd' => $secs / 86400 % 7,
'h' => $secs / 3600 % 24,
'm' => $secs / 60 % 60,
's' => $secs % 60);
$ret = array();
$added = false;
foreach ($vals as $k => $v) {
if ($v > 0 || $added) {
$added = true;
$ret[] = $v . $k;
}

}

return join(' ', $ret);
}

?>




Helping via AIM.


It look sexy tyvm ^_^
Member
Posts: 1,937
Joined: Apr 6 2008
Gold: 1.00
Warn: 30%
Aug 13 2009 08:11pm
When I put the .htaccess file in then all files within that directory becomes forbidden but if I remove it then everything works but it won't write .png.php5 as .png.

Help?
Member
Posts: 39,849
Joined: Apr 9 2009
Gold: 3,656.09
Aug 13 2009 09:30pm
How do you know what font should i add for my sig?

I dont get it


PLEASE HELP ME!



Member
Posts: 1,937
Joined: Apr 6 2008
Gold: 1.00
Warn: 30%
Aug 13 2009 09:33pm
Quote (MelsonX @ Thu, 13 Aug 2009, 21:30)
How do you know what font should i add for my sig?

I dont get it


PLEASE HELP ME!

I didn't understand what you just said but if it's what I'm thinking

Look for

// set the font and print text
$font = '/avqest.ttf';

and change avquest.tff to the font you would like to use. Make sure you upload it to the same directory.

This post was edited by Burly on Aug 13 2009 09:43pm
Member
Posts: 39,849
Joined: Apr 9 2009
Gold: 3,656.09
Aug 14 2009 07:22pm
Quote (Burly @ Thu, Aug 13 2009, 08:33pm)
I didn't understand what you just said but if it's what I'm thinking

Look for

// set the font and print text
$font = '/avqest.ttf';

and change avquest.tff to the font you would like to use. Make sure you upload it to the same directory.


Do you i have to rename them exactly what it says?
Where can you the exact font?

This post was edited by MelsonX on Aug 14 2009 07:22pm
Member
Posts: 9,614
Joined: Apr 21 2008
Gold: 7,601.66
Aug 14 2009 09:08pm
Quote (MelsonX @ Sat, 15 Aug 2009, 02:22)
Do you i have to rename them exactly what it says?
Where can you the exact font?


Quote (from User Info)
Location: USA


youre english is very hard to understand...

no, you dont have to rename the font, you have to upload the font you want to use and write its name in your php instad of the avqest.ttf

This post was edited by cyphrex on Aug 14 2009 09:09pm
Go Back To Ladder Slasher Topic List
Prev1515253545560Next
Add Reply New Topic New Poll