PDA

View Full Version : Old dynamic signature



Wanted
12-28-2009, 12:17 AM
Can someone give me PHP source code that will take the stats from the SMS data base (http://scriptmanager.freehostia.com/scripts.php?sid=3) and put them into this image:

http://i25.tinypic.com/o8fbsj.png

That being said, will cut off any text that might hang over into my name.

Or if you're really bored/ generous

http://i28.tinypic.com/24gog20.gif

Something that will put stats in to that one.

Many thanks.

Awkwardsaw
12-28-2009, 02:48 AM
ill try.. 1 sec :D

e: is there a function in php thats like between(s1, s2, s), like in SCAR? that would be extremely useful :D

Wanted
12-28-2009, 02:57 AM
ill try.. 1 sec :D

yayz :D

e: is there a function thats like between(s1, s2, s) in SCAR? that would be extremely useful :D[

A: Yes. Between(s1, s1, s: string): string;

A G E N T
12-28-2009, 04:33 AM
I can throw something together quickly if you like, as for the animated one, my first choice would be to use ImageMagick, but you probably don't have that, so I'll look for a native PHP class for animated GIFs...

Edit:
Here we are, I have attached a rar with arial.ttf in it, make sure it is in the same directory as the script (of course you can use whatever font you like, on Windows you can find fonts at X:\WINDOWS\Fonts)
I have also attached the picture file "base.png"; make sure that also goes in the same directory.


<?PHP
#setup
$font = "./arial.ttf";
$size = 8; //probably should leave this
$colour = 16777215; //0 = black, 16777215 = white, 255 = blue; SCAR has extensive colour functions so
# you should be able to figure out what you want using that and hex-rgb-dec converters

$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, "http://scriptmanager.freehostia.com/scripts.php?sid=3");
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
$res = curl_exec($ch);
preg_match('/<td>Total Time<.td>[\s]+<td(.*?)>[\s]+(.*?)<.td>/', $res, $matches);
$time = trim($matches[2]);
preg_match('/<td.*>Rune Essence Crafted<.td>[\s]+<td.*?>[\s]*?(.*?)<.td>/', $res, $matches);
$ess = trim($matches[1]);

$im = imagecreatefrompng("base.png");
$b1 = imagettfbbox(12, 0, $font, $time);
while(($b1[2]-$b1[0])>134)
{
$time = substr($time, 0, -1);
$b1 = imagettfbbox(8, 0, $font, $time);
}
imagettftext($im, 8, 0, 203, (31+$b1[1]-$b1[7]), $colour, $font, $time);
$b2 = imagettfbbox(8, 0, $font, $ess);
while(($b2[2]-$b2[0])>211)
{
$ess = substr($ess, 0, -1);
$b2 = imagettfbbox(8, 0, $font, $ess);
}
imagettftext($im, 8, 0, 128, (42+$b2[1]-$b2[7]), $colour, $font, $ess);
header("Content-Type: image/png");
imagepng($im);
?>

Wanted
12-28-2009, 04:37 AM
I can throw something together quickly if you like, as for the animated one, my first choice would be to use ImageMagick, but you probably don't have that, so I'll look for a native PHP class for animated GIFs...

Yea do it.

A G E N T
12-28-2009, 04:53 AM
I did find a native PHP class after all but it ended up causing weird a weird flickering on the text - maybe I'll figure it out tomorrow, I have nothing else to do ;)

P.S I edited the script into my post above.

Wanted
12-28-2009, 05:00 AM
I did find a native PHP class after all but it ended up causing weird a weird flickering on the text - maybe I'll figure it out tomorrow, I have nothing else to do ;)

P.S I edited the script into my post above.

wow thx!

Couple of questions.

1) I want to use Berlin Sans FB size 14, is there a way I can upload that to my online data base thingy and use it?
2) The total time some times is too long, so it's good to have something that trims it before it goes into the By part (bought 2 chars width space) and it's also good to replace Month / mn, year / y, day /d, week / w, minute/m ect. like on http://akwardsaw.hostoi.com/icefire/dyn_sig.php (that pic doesn't work though even though it looks like it does) how would I go about doing all this?

A G E N T
12-28-2009, 05:13 AM
Where it says:
$font = "./arial.ttf";
as long as you upload the proper font file, you can change that to the name of the font file you want to use ("BRLNSDB.TTF", etc). Be careful with making the font too big though as it might screw up the alignment and such, but 14 should be OK (you can also change size, $size, in the script).

I changed it to use D,H,M instead of the full words, was just a matter of doing a simple str_replace on each. I already made it so that it will simply cut off whatever extra length is on the end, but with the abbreviated D,M,H, it shouldn't be an issue; the other option is to scale down the font size as the text gets longer so that it will always fit.


<?PHP
#setup
$font = "./arial.ttf";
$size = 8; //probably should leave this
$colour = 16777215; //0 = black, 16777215 = white, 255 = blue; SCAR has extensive colour functions so
# you should be able to figure out what you want using that and hex-rgb-dec converters

$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, "http://scriptmanager.freehostia.com/scripts.php?sid=3");
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
$res = curl_exec($ch);
preg_match('/<td>Total Time<.td>[\s]+<td(.*?)>[\s]+(.*?)<.td>/', $res, $matches);
$time = trim($matches[2]);
$time = str_replace(array(" days", " day"), "D", $time);
$time = str_replace(array(" hours", " hour"), "H", $time);
$time = str_replace(array(" minutes", " minute"), "M", $time);
$time = str_replace(" and", ",", $time);
preg_match('/<td.*>Rune Essence Crafted<.td>[\s]+<td.*?>[\s]*?(.*?)<.td>/', $res, $matches);
$ess = trim($matches[1]);

$im = imagecreatefrompng("base.png");
$b1 = imagettfbbox(12, 0, $font, $time);
while(($b1[2]-$b1[0])>134)
{
$time = substr($time, 0, -1);
$b1 = imagettfbbox($size, 0, $font, $time);
}
imagettftext($im, $size, 0, 203, (31+$b1[1]-$b1[7]), $colour, $font, $time);
$b2 = imagettfbbox($size, 0, $font, $ess);
while(($b2[2]-$b2[0])>211)
{
$ess = substr($ess, 0, -1);
$b2 = imagettfbbox($size, 0, $font, $ess);
}
imagettftext($im, $size, 0, 128, (42+$b2[1]-$b2[7]), $colour, $font, $ess);
header("Content-Type: image/png");
imagepng($im);
?>

Wanted
12-28-2009, 06:54 AM
Thanks loads man, could you get on MSN though? I'm having trouble getting it fully working.

Edit

Got it fully working man, TY.

See if you can do the .GIF if you want as I am interested :)

http://icefire908.100webspace.net/RCrBDynamicSig.php

code841
12-28-2009, 11:57 AM
You can dynamically create animated GIFs in PHP. You will need to use the GIFEncoder.class.php (http://www.phpclasses.org/browse/package/3163.html) to generate an animated gif from single frames. Well I did when I was doing a similar thing.

You may want to also add "imagedestroy($im);" at the end of your current script to free it from your server's memory.

MylesMadness
12-28-2009, 05:15 PM
Thanks loads man, could you get on MSN though? I'm having trouble getting it fully working.

Edit

Got it fully working man, TY.

See if you can do the .GIF if you want as I am interested :)

http://icefire908.netai.net/RCrBDynamicSig.phplawl. Your site got banned

Wanted
12-28-2009, 05:17 PM
lawl. Your site got banned

What?


You can dynamically create animated GIFs in PHP. You will need to use the GIFEncoder.class.php (http://www.phpclasses.org/browse/package/3163.html) to generate an animated gif from single frames. Well I did when I was doing a similar thing.

You may want to also add "imagedestroy($im);" at the end of your current script to free it from your server's memory.

I added that line, I'll look into that GIF stuff later.. .thanks

MylesMadness
12-28-2009, 05:18 PM
What?Go to your 000webhost site

Wanted
12-28-2009, 05:21 PM
Go to your 000webhost site

You know I just registered that website yesterday and haven't uploaded anything to index, nor do I care if the domain says I'm banned as long as it displays my signature right?

MylesMadness
12-28-2009, 05:23 PM
You know I just registered that website yesterday and haven't uploaded anything to index, nor do I care if the domain says I'm banned as long as it displays my signature right?The problem is your sig doesn't show...

Wanted
12-28-2009, 05:29 PM
The problem is your sig doesn't show...

http://i48.tinypic.com/9vd3qh.jpg

MylesMadness
12-28-2009, 05:32 PM
http://i50.tinypic.com/2elfthd.png

Wanted
12-28-2009, 05:39 PM
http://i50.tinypic.com/2elfthd.png

Well maybe your browser does not support PHP images, I have the same problem with my phone.

MylesMadness
12-28-2009, 05:42 PM
Well maybe your browser does not support PHP images, I have the same problem with my phone.I think your browser is caching the image. Becuase when I try to visit that image directly I get that under review notice.

Wanted
12-28-2009, 06:18 PM
Edit:

That webserver was gay anyways

I moved to http://icefire908.100webspace.net

do you see it now?

MylesMadness
12-28-2009, 06:19 PM
Yeah I see it now. Cool

A G E N T
12-28-2009, 10:40 PM
I made this, it seems to work pretty well (although messy), you will need the GIFEncoder.class.php, someone posted a link above.


<?php
include "GIFEncoder.class.php";
#setup
$font = "./arial.ttf";
$size = 8; //probably should leave this
$colour = 0; //0 = black, 16777215 = white, 255 = blue; SCAR has extensive colour functions so
# you should be able to figure out what you want using that and hex-rgb-dec converters

$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, "http://scriptmanager.freehostia.com/scripts.php?sid=3");
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
$res = curl_exec($ch);
preg_match('/<td>Total Time<.td>[\s]+<td(.*?)>[\s]+(.*?)<.td>/', $res, $matches);
$time = trim($matches[2]);
$time = str_replace(array(" years", " year"), "Y", $time);
$time = str_replace(array(" months", " month"), "M", $time);
$time = str_replace(array(" weeks", " week"), "W", $time);
$time = str_replace(array(" days", " day"), "D", $time);
$time = str_replace(array(" hours", " hour"), "H", $time);
$time = str_replace(array(" minutes", " minute"), "M", $time);
$time = str_replace(" and", ",", $time);
preg_match('/<td.*>Rune Essence Crafted<.td>[\s]+<td.*?>[\s]*?(.*?)<.td>/', $res, $matches);
$ess = trim($matches[1]);

$b1 = imagettfbbox(12, 0, $font, $ess);
while(($b1[2]-$b1[0])>134)
{
$time = substr($ess, 0, -1);
$b1 = imagettfbbox($size, 0, $font, $ess);
}
$b2 = imagettfbbox($size, 0, $font, $time);
while(($b2[2]-$b2[0])>211)
{
$ess = substr($time, 0, -1);
$b2 = imagettfbbox($size, 0, $font, $time);
}
for($i=0;$i<=9;$i++)
{
$im = imagecreatefromgif("frames/".$i.".gif");
$black = imagecolorallocate($im, 0, 0, 0);
imagettftext($im, $size, 0, 128, (41+($b2[1]-$b2[7])), $colour, $font, trim($time));
imagettftext($im, $size, 0, 203, (29+($b1[1]-$b1[7])), $colour, $font, trim($ess));
ob_start();
imagegif($im);
$frames[] = ob_get_clean();
imagedestroy($im);
}

/*
GIFEncoder constructor:
=======================

image_stream = new GIFEncoder (
URL or Binary data 'Sources'
int 'Delay times'
int 'Animation loops'
int 'Disposal'
int 'Transparent red, green, blue colors'
int 'Source type'
);
*/
$gif = new GIFEncoder (
$frames,
$framed,
0,
2,
-1, -1, -1,
"bin"
);
Header ( 'Content-type:image/gif' );
echo $gif->GetAnimation ( );
?>

Wanted
12-29-2009, 04:08 AM
I made this, it seems to work pretty well (although messy), you will need the GIFEncoder.class.php, someone posted a link above.


<?php
include "GIFEncoder.class.php";
#setup
$font = "./arial.ttf";
$size = 8; //probably should leave this
$colour = 0; //0 = black, 16777215 = white, 255 = blue; SCAR has extensive colour functions so
# you should be able to figure out what you want using that and hex-rgb-dec converters

$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, "http://scriptmanager.freehostia.com/scripts.php?sid=3");
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
$res = curl_exec($ch);
preg_match('/<td>Total Time<.td>[\s]+<td(.*?)>[\s]+(.*?)<.td>/', $res, $matches);
$time = trim($matches[2]);
$time = str_replace(array(" years", " year"), "Y", $time);
$time = str_replace(array(" months", " month"), "M", $time);
$time = str_replace(array(" weeks", " week"), "W", $time);
$time = str_replace(array(" days", " day"), "D", $time);
$time = str_replace(array(" hours", " hour"), "H", $time);
$time = str_replace(array(" minutes", " minute"), "M", $time);
$time = str_replace(" and", ",", $time);
preg_match('/<td.*>Rune Essence Crafted<.td>[\s]+<td.*?>[\s]*?(.*?)<.td>/', $res, $matches);
$ess = trim($matches[1]);

$b1 = imagettfbbox(12, 0, $font, $ess);
while(($b1[2]-$b1[0])>134)
{
$time = substr($ess, 0, -1);
$b1 = imagettfbbox($size, 0, $font, $ess);
}
$b2 = imagettfbbox($size, 0, $font, $time);
while(($b2[2]-$b2[0])>211)
{
$ess = substr($time, 0, -1);
$b2 = imagettfbbox($size, 0, $font, $time);
}
for($i=0;$i<=9;$i++)
{
$im = imagecreatefromgif("frames/".$i.".gif");
$black = imagecolorallocate($im, 0, 0, 0);
imagettftext($im, $size, 0, 128, (41+($b2[1]-$b2[7])), $colour, $font, trim($time));
imagettftext($im, $size, 0, 203, (29+($b1[1]-$b1[7])), $colour, $font, trim($ess));
ob_start();
imagegif($im);
$frames[] = ob_get_clean();
imagedestroy($im);
}

/*
GIFEncoder constructor:
=======================

image_stream = new GIFEncoder (
URL or Binary data 'Sources'
int 'Delay times'
int 'Animation loops'
int 'Disposal'
int 'Transparent red, green, blue colors'
int 'Source type'
);
*/
$gif = new GIFEncoder (
$frames,
$framed,
0,
2,
-1, -1, -1,
"bin"
);
Header ( 'Content-type:image/gif' );
echo $gif->GetAnimation ( );
?>


Pretty cool, I'll try to get that to work.

I'm working on adding pictures of each rune and essence with RS chars that show the amount of each, just wondering if you knew a way to convert like

(over 9999k)

i.e.

10,495,532 to 10M

200,485,421 to 200M

or

(over 99,999)

101,482 to 101k (but white)
394,000 to 394k (but white)

I'll probably find a way to make my own TTF files for the font.

Edit:

http://icefire908.netai.net/NewOriginal.png

Now all I need is help making smallchars into a .ttf (truetype) file (maybe find some program that turns the bitmaps in the fonts folder into .ttf) or someother way of putting smallchars on top of it dynamically using PHP... and maybe some help coding all the PHP to change the number values to values like 100K ect.. and prase them from the SMS database.

Any help would be greatly appreciated!

A G E N T
12-29-2009, 06:04 AM
For the font, looks like somebody has already made it:
http://sites.google.com/site/interactiverune/files/runescape_small.zip?attredirects=0
(from http://runescape.salmoneus.net/forums/index.php?showtopic=296997)

For the conversions to K, M, etc, I did this:


<?PHP
function rsformat($value)
{
$letters = array(3=>"K", 6=>"M", 9=>"B");
if($value >= 100000)
{
$exp = floor(log($value, 10));
$num = $value/pow(10, $exp);
if(($exp % 3) != 0)
{
$num = $num * pow(10, ($exp % 3));
$exp = $exp - ($exp % 3);
}
elseif(($exp % 3) == 0)
{
$num = $num * 1000;
$exp += -3;
}
return floor($num).$letters[$exp];
}
else return $value;
}

$nums = array(1234, 12340, 1234000, 12340000, 123400000, 1234000000);
foreach($nums as $key=>$value)
{
echo ($key+1).": $value <br>";
echo rsformat($value)."<br>";
}
?>

Cheers :)

Wanted
12-29-2009, 06:14 AM
For the font, looks like somebody has already made it:
http://sites.google.com/site/interactiverune/files/runescape_small.zip?attredirects=0
(from http://runescape.salmoneus.net/forums/index.php?showtopic=296997)

For the conversions to K, M, etc, I did this:


<?PHP
function rsformat($value)
{
$letters = array(3=>"K", 6=>"M", 9=>"B");
if($value >= 100000)
{
$exp = floor(log($value, 10));
$num = $value/pow(10, $exp);
if(($exp % 3) != 0)
{
$num = $num * pow(10, ($exp % 3));
$exp = $exp - ($exp % 3);
}
elseif(($exp % 3) == 0)
{
$num = $num * 1000;
$exp += -3;
}
return floor($num).$letters[$exp];
}
else return $value;
}

$nums = array(1234, 12340, 1234000, 12340000, 123400000, 1234000000);
foreach($nums as $key=>$value)
{
echo ($key+1).": $value <br>";
echo rsformat($value)."<br>";
}
?>

Cheers :)

z0mg!

I've been spending hours trying to get all this stuff

TY x 9000

code841
12-29-2009, 06:34 AM
The easiest way to change the text colour would be in your for loop, simple checks like:
If($ess >= 100000) {
$colour2 = imagecolorallocate($im, 255, 255, 255); //white
}
This will change the font colour in your: imagettftext($im, $size, 0, 203, (29+($b1[1]-$b1[7])), $colour2, $font, trim($ess));
You can keep the original $colour variable but you'd have to insert your code in between the time and amount imagettftext otherwise the $time font colour would change too.

And that is a nice conversion function.

Wanted
12-29-2009, 10:05 AM
Ok guys, the code is messy as hell and it's 4 AM right now

but I did it

http://icefire908.netai.net/RCrBDynamicSig.php


<?PHP
#setup
$timefont = "./Antigoni bold.ttf";
$smallfont = "./runescape_small.ttf";
$timesize = 12; //probably should leave this
$smallsize = 12; //12 is da numbeer
$timecolor = 0; //0 = black, 16777215 = white, 255 = blue; SCAR has extensive colour functions so
# you should be able to figure out what you want using that and hex-rgb-dec converters

$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, "http://scriptmanager.freehostia.com/scripts.php?sid=3");
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
$res = curl_exec($ch);

preg_match('/<td>Total Time<.td>[\s]+<td(.*?)>[\s]+(.*?)<.td>/', $res, $matches);
$time = trim($matches[2]);

$time = str_replace(array(" days", " day"), "D", $time);
$time = str_replace(array(" hours", " hour"), "H", $time);
$time = str_replace(array(" minutes", " minute"), "M", $time);
$time = str_replace(" and ", ",", $time);

preg_match('/<td.*>Rune Essence Crafted<.td>[\s]+<td.*?>[\s]*?(.*?)<.td>/', $res, $matches);
$ess = trim($matches[1]);

preg_match('/<td.*>Air Runes<.td>[\s]+<td.*?>[\s]*?(.*?)<.td>/', $res, $matches);
$airs = trim($matches[1]);

preg_match('/<td.*>Mind Runes<.td>[\s]+<td.*?>[\s]*?(.*?)<.td>/', $res, $matches);
$minds = trim($matches[1]);

preg_match('/<td.*>Water Runes<.td>[\s]+<td.*?>[\s]*?(.*?)<.td>/', $res, $matches);
$waters = trim($matches[1]);

preg_match('/<td.*>Earth Runes<.td>[\s]+<td.*?>[\s]*?(.*?)<.td>/', $res, $matches);
$earths = trim($matches[1]);

preg_match('/<td.*>Fire Runes<.td>[\s]+<td.*?>[\s]*?(.*?)<.td>/', $res, $matches);
$fires = trim($matches[1]);

preg_match('/<td.*>Body Runes<.td>[\s]+<td.*?>[\s]*?(.*?)<.td>/', $res, $matches);
$bodys = trim($matches[1]);

preg_match('/<td.*>Cosmic Runes<.td>[\s]+<td.*?>[\s]*?(.*?)<.td>/', $res, $matches);
$cosmics = trim($matches[1]);

preg_match('/<td.*>Choas Runes<.td>[\s]+<td.*?>[\s]*?(.*?)<.td>/', $res, $matches);
$choas = trim($matches[1]);

preg_match('/<td.*>Nature Runes<.td>[\s]+<td.*?>[\s]*?(.*?)<.td>/', $res, $matches);
$natures = trim($matches[1]);

preg_match('/<td.*>Law Runes<.td>[\s]+<td.*?>[\s]*?(.*?)<.td>/', $res, $matches);
$laws = trim($matches[1]);

preg_match('/<td.*>Death Runes<.td>[\s]+<td.*?>[\s]*?(.*?)<.td>/', $res, $matches);
$deaths = trim($matches[1]);

preg_match('/<td.*>Blood Runes<.td>[\s]+<td.*?>[\s]*?(.*?)<.td>/', $res, $matches);
$bloods = trim($matches[1]);

preg_match('/<td.*>Soul Runes<.td>[\s]+<td.*?>[\s]*?(.*?)<.td>/', $res, $matches);
$souls = trim($matches[1]);

preg_match('/<td.*>Astral Runes<.td>[\s]+<td.*?>[\s]*?(.*?)<.td>/', $res, $matches);
$astrals = trim($matches[1]);

preg_match('/<td.*>Pouches Filled<.td>[\s]+<td.*?>[\s]*?(.*?)<.td>/', $res, $matches);
$pouches = trim($matches[1]);

preg_match('/<td.*>Trips Completed<.td>[\s]+<td.*?>[\s]*?(.*?)<.td>/', $res, $matches);
$trips = trim($matches[1]);

preg_match('/<td.*>Runecrafting EXP<.td>[\s]+<td.*?>[\s]*?(.*?)<.td>/', $res, $matches);
$rcexp = trim($matches[1]);

preg_match('/<td.*>Total Randoms<.td>[\s]+<td.*?>[\s]*?(.*?)<.td>/', $res, $matches);
$rsrandoms = trim($matches[1]);

preg_match('/<td.*>Script Start Ups<.td>[\s]+<td.*?>[\s]*?(.*?)<.td>/', $res, $matches);
$rcrbruns = trim($matches[1]);

$im = imagecreatefrompng("NewOriginal.png");

function rsformat($value)
{
$letters = array(3=>"K", 6=>"M", 9=>"B");
if($value >= 100000)
{
$exp = floor(log($value, 10));
$num = $value/pow(10, $exp);

if(($exp % 3) != 0)
{
$num = $num * pow(10, ($exp % 3));
$exp = $exp - ($exp % 3);
}
elseif(($exp % 3) == 0)
{
$num = $num * 1000;
$exp += -3;
}
return floor($num).$letters[$exp];
}
else return $value;
}

$esscolor = imagecolorallocate($im, 255, 255, 0);

If($ess >= 99999) {
$esscolor = imagecolorallocate($im, 255, 255, 255); //white
}

If($ess >= 9999999) {
$esscolor = imagecolorallocate($im, 0, 255, 0); //green
}


$airscolor = imagecolorallocate($im, 255, 255, 0);

If($airs >= 99999) {
$airscolor = imagecolorallocate($im, 255, 255, 255); //white
}

If($airs >= 9999999) {
$airscolor = imagecolorallocate($im, 0, 255, 0); //green
}



$mindscolor = imagecolorallocate($im, 255, 255, 0);

If($minds >= 99999) {
$mindscolor = imagecolorallocate($im, 255, 255, 255); //white
}

If($minds >= 9999999) {
$mindscolor = imagecolorallocate($im, 0, 255, 0); //green
}



$waterscolor = imagecolorallocate($im, 255, 255, 0);

If($waters >= 99999) {
$waterscolor = imagecolorallocate($im, 255, 255, 255); //white
}

If($waters >= 9999999) {
$waterscolor = imagecolorallocate($im, 0, 255, 0); //green
}



$earthscolor = imagecolorallocate($im, 255, 255, 0);

If($earths >= 99999) {
$earthscolor = imagecolorallocate($im, 255, 255, 255); //white
}

If($earths >= 9999999) {
$earthscolor = imagecolorallocate($im, 0, 255, 0); //green
}



$firescolor = imagecolorallocate($im, 255, 255, 0);

If($fires >= 99999) {
$firescolor = imagecolorallocate($im, 255, 255, 255); //white
}

If($fires >= 9999999) {
$firescolor = imagecolorallocate($im, 0, 255, 0); //green
}



$bodyscolor = imagecolorallocate($im, 255, 255, 0);

If($bodys >= 99999) {
$bodyscolor = imagecolorallocate($im, 255, 255, 255); //white
}

If($bodys >= 9999999) {
$bodyscolor = imagecolorallocate($im, 0, 255, 0); //green
}


$cosmicscolor = imagecolorallocate($im, 255, 255, 0);

If($cosmics >= 99999) {
$cosmicscolor = imagecolorallocate($im, 255, 255, 255); //white
}

If($cosmics >= 9999999) {
$cosmicscolor = imagecolorallocate($im, 0, 255, 0); //green
}



$choascolor = imagecolorallocate($im, 255, 255, 0);

If($choas >= 99999) {
$choascolor = imagecolorallocate($im, 255, 255, 255); //white
}

If($choas >= 9999999) {
$choascolor = imagecolorallocate($im, 0, 255, 0); //green
}



$naturescolor = imagecolorallocate($im, 255, 255, 0);

If($natures >= 99999) {
$naturescolor = imagecolorallocate($im, 255, 255, 255); //white
}

If($natures >= 9999999) {
$naturescolor = imagecolorallocate($im, 0, 255, 0); //green
}


$lawscolor = imagecolorallocate($im, 255, 255, 0);

If($laws >= 99999) {
$lawscolor = imagecolorallocate($im, 255, 255, 255); //white
}

If($laws >= 9999999) {
$lawscolor = imagecolorallocate($im, 0, 255, 0); //green
}


$deathscolor = imagecolorallocate($im, 255, 255, 0);

If($deaths >= 99999) {
$deathsscolor = imagecolorallocate($im, 255, 255, 255); //white
}

If($deathss >= 9999999) {
$deathscolor = imagecolorallocate($im, 0, 255, 0); //green
}


$bloodscolor = imagecolorallocate($im, 255, 255, 0);

If($bloods >= 99999) {
$bloodscolor = imagecolorallocate($im, 255, 255, 255); //white
}

If($bloods >= 9999999) {
$bloodscolor = imagecolorallocate($im, 0, 255, 0); //green
}


$soulscolor = imagecolorallocate($im, 255, 255, 0);

If($souls >= 99999) {
$soulscolor = imagecolorallocate($im, 255, 255, 255); //white
}

If($souls >= 9999999) {
$soulscolor = imagecolorallocate($im, 0, 255, 0); //green
}


$astralscolor = imagecolorallocate($im, 255, 255, 0);

If($astrals >= 99999) {
$astralscolor = imagecolorallocate($im, 255, 255, 255); //white
}

If($astrals >= 9999999) {
$astralscolor = imagecolorallocate($im, 0, 255, 0); //green
}


$pouchescolor = imagecolorallocate($im, 255, 255, 0);

If($pouches >= 99999) {
$pouchescolor = imagecolorallocate($im, 255, 255, 255); //white
}

If($pouches >= 9999999) {
$pouchescolor = imagecolorallocate($im, 0, 255, 0); //green
}



$tripscolor = imagecolorallocate($im, 255, 255, 0);

If($trips >= 99999) {
$tripscolor = imagecolorallocate($im, 255, 255, 255); //white
}

If($trips >= 9999999) {
$tripscolor = imagecolorallocate($im, 0, 255, 0); //green
}



$rcexpcolor = imagecolorallocate($im, 255, 255, 0);

If($rcexp >= 99999) {
$rcexpcolor = imagecolorallocate($im, 255, 255, 255); //white
}

If($rcexp >= 9999999) {
$rcexpcolor = imagecolorallocate($im, 0, 255, 0); //green
}



$rsrandomscolor = imagecolorallocate($im, 255, 255, 0);

If($rsrandoms >= 99999) {
$rsrandomscolor = imagecolorallocate($im, 255, 255, 255); //white
}

If($rsrandoms >= 9999999) {
$rsrandomscolor = imagecolorallocate($im, 0, 255, 0); //green
}



$rcrbrunscolor = imagecolorallocate($im, 255, 255, 0);

If($rcrbruns >= 99999) {
$rcrbrunscolor = imagecolorallocate($im, 255, 255, 255); //white
}

If($rcrbruns >= 9999999) {
$rcrbrunscolor = imagecolorallocate($im, 0, 255, 0); //green
}


imagettftext($im, $smallsize, 0, 27, (82+$b1[1]-$b1[7]), $esscolor, $smallfont, rsformat($ess));

imagettftext($im, $smallsize, 0, 72, (82+$b1[1]-$b1[7]), $airscolor, $smallfont, rsformat($airs));

imagettftext($im, $smallsize, 0, 115, (82+$b1[1]-$b1[7]), $mindscolor, $smallfont, rsformat($minds));

imagettftext($im, $smallsize, 0, 160, (82+$b1[1]-$b1[7]), $waterscolor, $smallfont, rsformat($waters));

imagettftext($im, $smallsize, 0, 203, (82+$b1[1]-$b1[7]), $earthscolor, $smallfont, rsformat($earths));

imagettftext($im, $smallsize, 0, 248, (82+$b1[1]-$b1[7]), $firescolor, $smallfont, rsformat($fires));

imagettftext($im, $smallsize, 0, 292, (82+$b1[1]-$b1[7]), $bodyscolor, $smallfont, rsformat($bodys));

imagettftext($im, $smallsize, 0, 336, (82+$b1[1]-$b1[7]), $cosmicscolor, $smallfont, rsformat($cosmics));

imagettftext($im, $smallsize, 0, 381, (82+$b1[1]-$b1[7]), $choascolor, $smallfont, rsformat($choas));

imagettftext($im, $smallsize, 0, 424, (82+$b1[1]-$b1[7]), $naturescolor, $smallfont, rsformat($natures));


imagettftext($im, $smallsize, 0, 28, (126+$b1[1]-$b1[7]), $lawscolor, $smallfont, rsformat($laws));

imagettftext($im, $smallsize, 0, 72, (126+$b1[1]-$b1[7]), $deathscolor, $smallfont, rsformat($deaths));

imagettftext($im, $smallsize, 0, 115, (126+$b1[1]-$b1[7]), $bloodscolor, $smallfont, rsformat($bloods));

imagettftext($im, $smallsize, 0, 160, (126+$b1[1]-$b1[7]), $soulscolor, $smallfont, rsformat($souls));

imagettftext($im, $smallsize, 0, 203, (126+$b1[1]-$b1[7]), $astralscolor, $smallfont, rsformat($astrals));

imagettftext($im, $smallsize, 0, 248, (126+$b1[1]-$b1[7]), $pouchescolor, $smallfont, rsformat($pouches));

imagettftext($im, $smallsize, 0, 292, (126+$b1[1]-$b1[7]), $tripscolor, $smallfont, rsformat($trips));

imagettftext($im, $smallsize, 0, 336, (126+$b1[1]-$b1[7]), $rcexpcolor, $smallfont, rsformat($rcexp));

imagettftext($im, $smallsize, 0, 381, (126+$b1[1]-$b1[7]), $rsrandomscolor, $smallfont, rsformat($rsrandoms));

imagettftext($im, $smallsize, 0, 425, (126+$b1[1]-$b1[7]), $rcrbrunscolor, $smallfont, rsformat($rcrbruns));



imagettftext($im, $timesize, 0, 80, (62+$b2[1]-$b2[7]), $timecolor, $timefont, $time);


header("Content-Type: image/png");
imagepng($im);
imagedestroy($im);
?>

Awkward saw, code, A G ENT, I'll add all of you to RCrB credits tomorrow! thanks for everything x >9001

going to bed now ZZZZzzzzzzZZz :ninja:

code841
12-29-2009, 11:41 AM
Nice, but most of that repetitive work can be cut down.
Eg.

<?PHP
#setup
$timefont = "/Antigoni bold.ttf";
$smallfont = "/runescape_small.ttf";
$timesize = 12; //probably should leave this
$smallsize = 12; //12 is da numbeer
$timecolor = 0; //0 = black, 16777215 = white, 255 = blue; SCAR has extensive colour functions so
# you should be able to figure out what you want using that and hex-rgb-dec converters

$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, "http://scriptmanager.freehostia.com/scripts.php?sid=3");
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
$res = curl_exec($ch);

preg_match('/<td>Total Time<.td>[\s]+<td(.*?)>[\s]+(.*?)<.td>/', $res, $matches);
$time = trim($matches[2]);
//Format time to simplified
$time = str_replace(array(" days", " day"), "D", $time);
$time = str_replace(array(" hours", " hour"), "H", $time);
$time = str_replace(array(" minutes", " minute"), "M", $time);
$time = str_replace(" and ", ",", $time);

//Retrieve rune counts
preg_match('/<td.*>Rune Essence Crafted<.td>[\s]+<td.*?>[\s]*?(.*?)<.td>/', $res, $matches);
$item[0] = trim($matches[1]);

preg_match('/<td.*>Air Runes<.td>[\s]+<td.*?>[\s]*?(.*?)<.td>/', $res, $matches);
$item[1] = trim($matches[1]);

preg_match('/<td.*>Mind Runes<.td>[\s]+<td.*?>[\s]*?(.*?)<.td>/', $res, $matches);
$item[2] = trim($matches[1]);

preg_match('/<td.*>Water Runes<.td>[\s]+<td.*?>[\s]*?(.*?)<.td>/', $res, $matches);
$item[3] = trim($matches[1]);

preg_match('/<td.*>Earth Runes<.td>[\s]+<td.*?>[\s]*?(.*?)<.td>/', $res, $matches);
$item[4] = trim($matches[1]);

preg_match('/<td.*>Fire Runes<.td>[\s]+<td.*?>[\s]*?(.*?)<.td>/', $res, $matches);
$item[5] = trim($matches[1]);

preg_match('/<td.*>Body Runes<.td>[\s]+<td.*?>[\s]*?(.*?)<.td>/', $res, $matches);
$item[6] = trim($matches[1]);

preg_match('/<td.*>Cosmic Runes<.td>[\s]+<td.*?>[\s]*?(.*?)<.td>/', $res, $matches);
$item[7] = trim($matches[1]);

preg_match('/<td.*>Choas Runes<.td>[\s]+<td.*?>[\s]*?(.*?)<.td>/', $res, $matches);
$item[8] = trim($matches[1]);

preg_match('/<td.*>Nature Runes<.td>[\s]+<td.*?>[\s]*?(.*?)<.td>/', $res, $matches);
$item[9] = trim($matches[1]);

preg_match('/<td.*>Law Runes<.td>[\s]+<td.*?>[\s]*?(.*?)<.td>/', $res, $matches);
$item[10] = trim($matches[1]);

preg_match('/<td.*>Death Runes<.td>[\s]+<td.*?>[\s]*?(.*?)<.td>/', $res, $matches);
$item[11] = trim($matches[1]);

preg_match('/<td.*>Blood Runes<.td>[\s]+<td.*?>[\s]*?(.*?)<.td>/', $res, $matches);
$item[12] = trim($matches[1]);

preg_match('/<td.*>Soul Runes<.td>[\s]+<td.*?>[\s]*?(.*?)<.td>/', $res, $matches);
$item[13] = trim($matches[1]);

preg_match('/<td.*>Astral Runes<.td>[\s]+<td.*?>[\s]*?(.*?)<.td>/', $res, $matches);
$item[14] = trim($matches[1]);

preg_match('/<td.*>Pouches Filled<.td>[\s]+<td.*?>[\s]*?(.*?)<.td>/', $res, $matches);
$item[15] = trim($matches[1]);

preg_match('/<td.*>Trips Completed<.td>[\s]+<td.*?>[\s]*?(.*?)<.td>/', $res, $matches);
$item[16] = trim($matches[1]);

preg_match('/<td.*>Runecrafting EXP<.td>[\s]+<td.*?>[\s]*?(.*?)<.td>/', $res, $matches);
$item[17] = trim($matches[1]);

preg_match('/<td.*>Total Randoms<.td>[\s]+<td.*?>[\s]*?(.*?)<.td>/', $res, $matches);
$item[18] = trim($matches[1]);

preg_match('/<td.*>Script Start Ups<.td>[\s]+<td.*?>[\s]*?(.*?)<.td>/', $res, $matches);
$item[19] = trim($matches[1]);

$im = imagecreatefrompng("http://icefire908.netai.net/NewOriginal.png");

function rsformat($value)
{
$letters = array(3=>"K", 6=>"M", 9=>"B");
if($value >= 100000)
{
$exp = floor(log($value, 10));
$num = $value/pow(10, $exp);

if(($exp % 3) != 0)
{
$num = $num * pow(10, ($exp % 3));
$exp = $exp - ($exp % 3);
}
elseif(($exp % 3) == 0)
{
$num = $num * 1000;
$exp += -3;
}
return floor($num).$letters[$exp];
}
else return $value;
}
$black = imagecolorallocate($im, 0, 0, 0); //black
$yellow = imagecolorallocate($im, 255, 255, 0); //yellow
$white = imagecolorallocate($im, 255, 255, 255); //white
$green = imagecolorallocate($im, 0, 255, 0); //green

$arrayX = array(27,72,115,160,203,248,292,336,381,424,27,72, 115,160,203,248,292,336,381,424);

for($i=0;$i<=19;$i++)
{

If($item[$i] > 99999) {
$color = $white;
} else {
$color = $yellow;
}
If($item[$i] > 9999999) {
$color = $green;
}
If($i > 9) {
$varY = 126;
} else {
$varY = 82;
}
imagettftext($im, $smallsize, 0, $arrayX[$i], ($varY+$b1[1]-$b1[7]), $color, $smallfont, rsformat($item[$i]));
}

imagettftext($im, $timesize, 0, 80, (62+$b2[1]-$b2[7]), $timecolor, $timefont, $time); //Create the time text

header("Content-Type: image/png");
imagepng($im); //Create image
imagedestroy($im); //Free image from memory
?>

The process in which you get your values into an array can be made simpler and in a loop, but I have not thought into how to go about it.

I like your design, it's impressive.

Wanted
12-29-2009, 05:23 PM
Thanks for the loops, I couldn't figure them out I'm a complete PHP noob.

Runescape uses a black shadow for the smallchars, how do I do this with php?

Edit: I'm trying drawing in black first then drawing in normal color next to it, I think it's working.

Edit: I think it worked :)

A G E N T
12-29-2009, 06:14 PM
Looks good :D
Just one thing I forgot, where you have


$time = str_replace(array(" days", " day"), "D", $time);
$time = str_replace(array(" hours", " hour"), "H", $time);
$time = str_replace(array(" minutes", " minute"), "M", $time);

You should add


$time = str_replace(array(" weeks", " week"), "W", $time);
$time = str_replace(array(" months", " month"), "M", $time);
$time = str_replace(array(" years", " year"), "Y", $time);

In case the numbers get that high.

Wanted
12-29-2009, 06:15 PM
Looks good :D
Just one thing I forgot, where you have


$time = str_replace(array(" days", " day"), "D", $time);
$time = str_replace(array(" hours", " hour"), "H", $time);
$time = str_replace(array(" minutes", " minute"), "M", $time);

You should add


$time = str_replace(array(" weeks", " week"), "W", $time);
$time = str_replace(array(" months", " month"), "M", $time);
$time = str_replace(array(" years", " year"), "Y", $time);

In case the numbers get that high.

K thx

Dynamite
12-29-2009, 06:20 PM
Looks, AMAZING!
Gratz guys

code841
12-30-2009, 02:12 AM
Nice work with the shadow effect on the text, did you make a black text layer that was shifted 1 pixel down and 1 to the right?

Wanted
12-30-2009, 02:20 AM
Nice work with the shadow effect on the text, did you make a black text layer that was shifted 1 pixel down and 1 to the right?

Yea I just did the same thing except I made the font black and X + 1 , Y + 1 right before it does the normal position color. Was widget's idea :)

Bobarkinator
12-30-2009, 03:43 AM
Yea I just did the same thing except I made the font black and X + 1 , Y + 1 right before it does the normal position color. Was widget's idea :)


That's how you're supposed to do drop shadow :) You can do it the same way in Photoshop.