Page 1 of 1

Experience bar image

Posted: Tue Dec 13, 2011 10:00 am
by stefans
Hello all,

I made an exp bar image, you can configure the height and the width of it, or just the standard (width = 100, height = 20)
Configured one:
Image

Code: Select all

http://skillaria.byethost3.com/phpimages/bar.php?amount=25&width=200&height=100
Default one:
Image

Code: Select all

http://skillaria.byethost3.com/phpimages/bar.php?amount=90
The code used for this image:

Code: Select all

<?php
if(!isset($_GET['height'])) {
	$height = 20;
} else {
	$height = $_GET['height'];
}
if(!isset($_GET['width'])) {
	$width = 100;
} else {
	$width = $_GET['width'];
}
$amount = intval($_GET['amount']);
$im = Imagecreatetruecolor($width, $height);
$red = Imagecolorallocate($im, 255, 0, 0);
$green = Imagecolorallocate($im, 0, 255, 0);
imagefill($im, 0, 0, $red);
imagefilledrectangle($im, 0, 0, $amount * $width/100, $height, $green);
$border = ImageColorAllocate($im, 0, 0, 0);
ImageRectangle($im, 0, 0, $width - 1, $height - 1, $border);
$font = 3;
$font_width = ImageFontWidth($font);
$font_height = ImageFontHeight($font);
$text = $amount . "%";
$text_width = $font_width * strlen($text);
$position_center = ceil(($width - $text_width) / 2);
$text_height = $font_height;
$position_middle = ceil(($height - $text_height) / 2);
$textcolor = imagecolorallocate($im, 0, 0, 0);
ImageString($im, $font, $position_center, $position_middle, $text, $textcolor);

header("Content-type: image/png");
Imagepng($im);
Imagedestroy($im);
?>
I don't know if this is a good code or not, but it works :) so..
Have fun!

Re: Experience bar image

Posted: Tue Dec 13, 2011 2:38 pm
by Jackolantern
Images seem to be broken :(

Re: Experience bar image

Posted: Tue Dec 13, 2011 2:48 pm
by stefans
yeah probably because they are reviewing my website --'
i hope they won't delete it..

Code: Select all

7. We do not allow online gaming scripts such as ogame, mafia, etc.. (allowed if you upgrade account)
XD

Re: Experience bar image

Posted: Tue Dec 13, 2011 2:59 pm
by Jackolantern
Who is your host? Do you actually have a whole, working game up on them?

Re: Experience bar image

Posted: Tue Dec 13, 2011 3:02 pm
by stefans
000webhost, i tried the other one, they recommended me.. but that site doesn't load at all..
and my game is not really finished yet.. XD
i don't have money for a paid host right now so..

Re: Experience bar image

Posted: Tue Dec 13, 2011 3:32 pm
by Jackolantern
Ohhhh, yeah...000 is quite game-unfriendly on their free hosting. You basically have to bait and switch on them and just put up some crap static pages for a couple of weeks until you are basically sure they have already checked it, then you can add your game scripts.

Re: Experience bar image

Posted: Tue Dec 13, 2011 4:13 pm
by stefans
updated image :p
i uploaded it on one of my older websites :p

Re: Experience bar image

Posted: Tue Dec 13, 2011 5:27 pm
by OldRod
ESET security blocks your links for some reason...

Re: Experience bar image

Posted: Tue Dec 13, 2011 5:43 pm
by stefans
weird :p

Re: Experience bar image

Posted: Tue Dec 13, 2011 6:17 pm
by Jackolantern
They still just look broken to me, and I don't use ESET :shock: