PDA

View Full Version : Slightly OT: Dynamic Signature Source



NeoLojik
30-09-03, 13:00
Hey all,

Well, after releasing my signature to the forums I got an influx of PM's asking for the source. Rather than PM everyone, one-by-one I decided to post it here where I can address questions and help out anyone who dosent quite understand something.

The script REQUIRES PHP 4.2.0+, GD 1.6.2+ and FreeType 2+, you can check if your webserver supports these by creating a file called phpinfo.php in your web directory with one line in it:
<?php phpinfo(); ?>You should then see a section for GD if its installed, giving all the details.

The following is the code for MULTIPLE characters:
<?php
/****************************************
* NeoLojik's Neocron Signature v1.2m *
* Copyright 2003 - Simon Davie *
* Contact: NeoLojik@NeoInfo.co.uk *
* *
* Requires: PHP 4.2.0+ *
* GD 1.6.2+ *
* FreeType 2+ *
****************************************/

//Variables
$CounterFile = ""; //Full path to a txt (containing a 0) file with a CHMOD of 777
$font = ""; //Full path to your TTF file

//Open, Get and Increment Counter
$count = implode ('', file ($CounterFile));
$count = 1 + $count;
$myFile=fopen($CounterFile,'w+');
fputs($myFile, $count);
fclose($myFile);

//Define Character and Picture random numbers
//3 Characters (0 - 2) and 5 Images (0 - 4)
$chrnumber = rand(0,2);
$imgnumber = rand(0,4);

//Pick our image
//Note: Images should be placed in a folder called 'images' and named
// as per example: neocron-bg-0-0.png
// The first number being the character number
// The second being the image
$im = imagecreatefrompng ("images/neocron-bg-$chrnumber-$imgnumber.png");

//Assign needed colours
$black = ImageColorAllocate ($im, 0, 0, 0);
$white = ImageColorAllocate ($im, 255, 255, 255);

//The imageTTFtext function uses the following parameters
//imageTTFtext (Image Handle, Font Size, Rotation, X Position, Y Position, Color Handle, Font Location, Text);

switch($chrnumber) {
case 0:
imageTTFtext ($im, 16, 0, 370, 20, $white, $font, "Javan Ikari");
imageTTFtext ($im, 10, 0, 485, 20, $white, $font, "63/65 **");
imageTTFtext ($im, 10, 0, 370, 34, $white, $font, "Pluto Near-Capped Rifle Spy");
break;

case 1:
imageTTFtext ($im, 16, 0, 370, 20, $white, $font, "Rice");
imageTTFtext ($im, 10, 0, 420, 20, $white, $font, "59/61 **");
imageTTFtext ($im, 10, 0, 370, 34, $white, $font, "Pluto Capped Tank");
break;

case 2:
imageTTFtext ($im, 16, 0, 370, 20, $white, $font, "Kendo Averly");
imageTTFtext ($im, 10, 0, 507, 20, $white, $font, "72/60 ***");
imageTTFtext ($im, 10, 0, 370, 34, $white, $font, "Pluto Support PPU Monk");
break;
}

//Calculate and output the delay of the SpyPA (1054853735 = 6th June 2003)
$SpyPADelay = intval(((time() - 1054853735) / 86400));

imageTTFtext ($im, 9, 0, 370, 81, $white, $font, "Spy Power-Armor Delay:");
imageTTFtext ($im, 9, 0, 370, 94, $white, $font, "$SpyPADelay days's and counting...");

//Draw view stats
imageTTFtext ($im, 9, 0, 5, 94, $white, $font, "Views: $count");

//Output the image at 90% Quality
ImageJPEG ($im, '', 90);
ImageDestroy ($im);
?>This will randomly choose a character, then randomly choose a background image and display the details for that charater with its picture.

To use this code, simply change my details to your own and upload 5 images for each character, in PNG-8 format, into an images directory named: neocron-bg-0-0.png thru neocron-bg-0-4.png.

The first number needs to be incremented for each character, eg:
neocron-bg-0-0.png thru neocron-bg-0-4.png - Char 1
neocron-bg-1-0.png thru neocron-bg-1-4.png - Char 2
neocron-bg-2-0.png thru neocron-bg-2-4.png - Char 3
etc, etc.

The following code is for use if you only have ONE character:
<?php
/****************************************
* NeoLojik's Neocron Signature v1.2s *
* Copyright 2003 - Simon Davie *
* Contact: NeoLojik@NeoInfo.co.uk *
* *
* Requires: PHP 4.2.0+ *
* GD 1.6.2+ *
* FreeType 2+ *
****************************************/

//Variables
$CounterFile = ""; //Full path to a txt (containing a 0) file with a CHMOD of 777
$font = ""; //Full path to your TTF file

//Open, Get and Increment Counter
$count = implode ('', file ($CounterFile));
$count = 1 + $count;
$myFile=fopen($CounterFile,'w+');
fputs($myFile, $count);
fclose($myFile);

//Define Picture random number
//5 Images (0 - 4)
$imgnumber = rand(0,4);

//Pick our image
//Note: Images should be placed in a folder called 'images' and named
// as per example: neocron-bg-0.png
$im = imagecreatefrompng ("images/neocron-bg-$imgnumber.png");

//Assign needed colours
$black = ImageColorAllocate ($im, 0, 0, 0);
$white = ImageColorAllocate ($im, 255, 255, 255);

//The imageTTFtext function uses the following parameters
//imageTTFtext (Image Handle, Font Size, Rotation, X Position, Y Position, Color Handle, Font Location, Text);

imageTTFtext ($im, 16, 0, 370, 20, $white, $font, "Javan Ikari");
imageTTFtext ($im, 10, 0, 485, 20, $white, $font, "63/65 **");
imageTTFtext ($im, 10, 0, 370, 34, $white, $font, "Pluto Near-Capped Rifle Spy");

//Calculate and output the delay of the SpyPA (1054853735 = 6th June 2003)
$SpyPADelay = intval(((time() - 1054853735) / 86400));

imageTTFtext ($im, 9, 0, 370, 81, $white, $font, "Spy Power-Armor Delay:");
imageTTFtext ($im, 9, 0, 370, 94, $white, $font, "$SpyPADelay days's and counting...");

//Draw view stats
imageTTFtext ($im, 9, 0, 5, 94, $white, $font, "Views: $count");

//Output the image at 90% Quality
ImageJPEG ($im, '', 90);
ImageDestroy ($im);
?>To use this code, simply change my details to your own and upload 5 image files in PNG-8 format into an images directory named: neocron-bg-0.png thru neocron-bg-4.png.

Reply to this thread for any help, I'll assist where I can.

\\Fényx//
30-09-03, 13:02
flash git :p



anyway man, how much did you pay for Rice ? Plus he isnt fully capped is he ?!? o_O

NeoLojik
30-09-03, 13:03
Originally posted by \\Fényx//
flash git :p

anyway man, how much did you pay for Rice ? Plus he isnt fully capped is he ?!? o_O Damn you going OT in my OT post :p

1) 50 Quid (Paid until Dec so £30 for new game + £18 3 month subscription)
2) All but 4 levels of constitution, but im working on that :D

*rubs his newly aquired 4 slot CS* :D

\\Fényx//
30-09-03, 13:05
Originally posted by NeoLojik
*rubs his newly aquired 4 slot CS* :D


4 slot? 120 120 120 113(range) ?!?

Radioactive?





BWAHAHAHAHAHAHAAHAHAHAHAHAHHAHAAHAHAHAHAHAHAHAHAHAHAHAHAAHAHAHAHAHAHHAHAAHAHAHAHAHAHAHAHAHAHAHAHAAHA HAHAHAHAHHAHAAHAHAHAHAHAHAHAHAHAHAHAHAAHAHAHAHAHAHHAHAAHAHAHAHAHAHAHAHAHAHAHAHAAHAHAHAHAHAHHAHAAHAHA HAHAHAHAHAHAHAHAHAHAAHAHAHAHAHAHHAHAAHAHAHAHAHAHAHAHAHAHAHAHAAHAHAHAHAHAHHAHAAHAHAHAHAHAHA!!!!




:lol: O_o :lol:

hinch
30-09-03, 13:05
hmmz if its all but 4 cons

my tank is /62 and i have 9 cons and 3 str left

you should be in the /64 rank area

NeoLojik
30-09-03, 13:09
Originally posted by \\Fényx//
4 slot? 120 120 120 113(range) ?!?

Radioactive?

*snip*

:lol: O_o :lol: Nope :lol:


Originally posted by hinch
hmmz if its all but 4 cons

my tank is /62 and i have 9 cons and 3 str left

you should be in the /64 rank area Yeah, I though it was a little weird. Im using a Zerk3, PP Res, Marine, MOVEON, Filter 2 and Hardenbackbone 3.

*shrug*

hinch
30-09-03, 13:11
you even havea +5 str imp in the zerk3 which i aint using

hrmp how very odd
with thouse imps i`d expect you to be /66 at least

Vampire222
30-09-03, 13:26
Originally posted by \\Fényx//
4 slot? 120 120 120 113(range) ?!?

Radioactive?





BWAHAHAHAHAHAHAAHAHAHAHAHAHHAHAAHAHAHAHAHAHAHAHAHAHAHAHAAHAHAHAHAHAHHAHAAHAHAHAHAHAHAHAHAHAHAHAHAAHA HAHAHAHAHHAHAAHAHAHAHAHAHAHAHAHAHAHAHAAHAHAHAHAHAHHAHAAHAHAHAHAHAHAHAHAHAHAHAHAAHAHAHAHAHAHHAHAAHAHA HAHAHAHAHAHAHAHAHAHAAHAHAHAHAHAHHAHAAHAHAHAHAHAHAHAHAHAHAHAHAAHAHAHAHAHAHHAHAAHAHAHAHAHAHA!!!!




:lol: O_o :lol:

theres xheated and force flavoured ones too... althou the xheat ones quite rare.. want a scoop of nice vanilla icecream now?

hinch
30-09-03, 13:29
vamps not that rare i got 2 now :) fire > *

\\Fényx//
30-09-03, 13:30
ok vamp :p ;)


Ahem... anyway yea

my tank's rank is normally /66 but every now and then hits 67 o_O


capped STR, Needs 6 CON, Has resistor, moveon, marine, amc3, hbb3, FH2 and has done 1 epic, Epics also seem to effect your rank.

NeoLojik
30-09-03, 13:49
*considers chaning the title of the thread to 'Tank Discussion' and starting a new thread for the sig*

meh :)

Im intersted in your tank setups, ive never had huge amounts of experience with them myself. I know Rice can shoot green blobs of CS at an amazing ratte though, oh, and that he caps damage on the CS too :D

@Fenix: Its not one of the duped CS's btw :P

hinch
30-09-03, 13:52
what rof does he get on the cs and what`s his hc i just find it strange i outrank you on both numbers and im no where near capped by tank standards

btw how long did it take you to cut out each character individually for random placement over your background.

i wouldnt mind something like that with each of my chars on it

\\Fényx//
30-09-03, 13:56
wha ?!? your kendo averly aswell o_O I thought u just shared chars o_O Since when was he yours aswell ?:confused:

NeoLojik
30-09-03, 14:01
Originally posted by hinch
what rof does he get on the cs and what`s his hc i just find it strange i outrank you on both numbers and im no where near capped by tank standards

btw how long did it take you to cut out each character individually for random placement over your background.

i wouldnt mind something like that with each of my chars on it CS ROF: 211
HC: 200+

I thought his ranks were a little low, im not sure why though :\

The Javan and Kendo images are me at Point Red, (Rice was screenshotted at J15 in the tower) with the RPOS turned off, in thrid person view with a custom angle (I forget the exact command but the angle value is 140). They are just full screenshots (1280x1024) with 6xAA and 16xAF. Each image is shrunk to 51% of its original size in photoshop, then cropped to 576x100 px :D

If you want any help, reply here, I'd be glad to see someone else using my script. You can use ANY TTF font too btw.


Originally posted by \\Fényx//
wha ?!? your kendo averly aswell o_O I thought u just shared chars o_O Since when was he yours aswell ?:confused: Kendo quit, I swapped him a copy of Battlefield 1942 for it :p

Ascension
30-09-03, 14:03
*keeps pressing refresh* Ah look at the counter saw up ^^

hinch
30-09-03, 14:10
well if you want to come and take a fuck load of pictures of me and make me one then your welcome to :)

i dont have a server with gd2 on only imagemagik and i dont fancy rewriting the code to fit image magik

NeoLojik
30-09-03, 16:12
@hinch
If I could host it for you I would, by my signature has had like 30Mb of traffic in 24 hours. Thats 900Mb a month without my site and the others I host :lol:

May not seem like a lot, but it is!

hinch
30-09-03, 16:14
heh the problem is youve written it in php :rolleyes:

if you`d done it in vbscript or .net then i have all the hosting i need just i only got like 3 linux servers and none of them have apache configured the way you need it

\\Fényx//
30-09-03, 16:14
Originally posted by NeoLojik
@hinch
If I could host it for you I would, by my signature has had like 30Mb of traffic in 24 hours. Thats 900Mb a month without my site and the others I host :lol:

May not seem like a lot, but it is!


I just added 50 to the counter by smacking refresh ^^ wanted to see if you had any more bloody chars o_O

NeoLojik
30-09-03, 16:17
Originally posted by hinch
heh the problem is youve written it in php :rolleyes:

if you`d done it in vbscript or .net then i have all the hosting i need just i only got like 3 linux servers and none of them have apache configured the way you need it It should be fine as long as you have GD and Freetype installed with PHP, obviously you'll get limited support from me :p


Originally posted by \\Fényx//
I just added 50 to the counter by smacking refresh ^^ wanted to see if you had any more bloody chars o_O Oh, I see, first you leech my bouncy smilie then you spam my signature o_O

:p

hinch
30-09-03, 16:19
thats the problem i dontwant to install them particularly :)

apache is flakey at the best of times especially in the hacked up config its runnign for me atm if i start asking it to do smart stuff its going to have a heart attack.

NeoLojik
30-09-03, 16:21
Originally posted by hinch
thats the problem i dontwant to install them particularly :)

apache is flakey at the best of times especially in the hacked up config its runnign for me atm if i start asking it to do smart stuff its going to have a heart attack. Ah, Apache, love it or hate it, its the best imo :p

"Linux much like Wigwam - No windows, No Gates, Apache Inside" :D

So you dont have GD or FreeType installed? Its not hard to do, and it intergrates into PHP not apache. PHP is just an apache module.

\\Fényx//
30-09-03, 16:21
Originally posted by NeoLojik
It should be fine as long as you have GD and Freetype installed with PHP, obviously you'll get limited support from me :p

Oh, I see, first you leech my bouncy smilie then you spam my signature o_O

:p



bah that richard slade leeche's more of the smiley's than me.... Only thing ive done is leech clan members from you muahahahahaha :lol: ;) ;)

NeoLojik
30-09-03, 16:26
Originally posted by \\Fényx//
bah that richard slade leeche's more of the smiley's than me.... Only thing ive done is leech clan members from you muahahahahaha :lol: ;) ;) Can't believe you managed to steal the ENTIRE clan :lol: Ah well, my 'lil clan is happy anyway.

hinch
30-09-03, 16:27
Originally posted by \\Fényx//
bah that richard slade leeche's more of the smiley's than me.... Only thing ive done is leech clan members from you muahahahahaha :lol: ;) ;)

ouch evil

neo no i mean apache config as in all the authentication and active directory linkage etc.

it isnt just a webserver install of apache if you get it it has some funky mods that depending on authmethod and auth username and password apache pre generates some content for the user.

its all very confusing.

for me to actually install php i`d first off need to recompile apache then make sure everything worked together again.

then install gd and freetype

its too much hastle just for an image :)

\\Fényx//
30-09-03, 16:31
Well they asked me if they could join then the rest came 8|

NeoLojik
30-09-03, 16:31
Originally posted by hinch
ouch evil

neo no i mean apache config as in all the authentication and active directory linkage etc.

it isnt just a webserver install of apache if you get it it has some funky mods that depending on authmethod and auth username and password apache pre generates some content for the user.

its all very confusing.

for me to actually install php i`d first off need to recompile apache then make sure everything worked together again.

then install gd and freetype

its too much hastle just for an image :) Ouch, been there, done that, lost 5lbs and some hair in the process. Apache + Active Directory = P.I.T.A. :)

Yeah, bit of a struggle for 1 image.

@fenix - Your both only leeching the image once, IE just multiplies it, so your bioth as bad as one another :p You have no idea how tempting it was to replace the image on my server to make your sigs say something quite different *evil grin*

hinch
30-09-03, 16:32
Originally posted by \\Fényx//
Well they asked me if they could join then the rest came 8|

which ones i havent noticed anyone appart from little rhodry btw i think we need to promote him back to recruit he likes that position

\\Fényx//
30-09-03, 16:34
rhod, komb@t, honour, warrior, =widowmaker=, resident 3vil, uhhhhhhh prolly some more, i think more anyway...


Yea neo I realised you could just make the image really bloody large and get us bollocked for breaking the rules lolz O_o

Legoias
30-09-03, 16:37
@NeoLojik are you a programmer by profession or just an enthusiast?

NeoLojik
30-09-03, 16:40
Originally posted by \\Fényx//
Yea neo I realised you could just make the image really bloody large and get us bollocked for breaking the rules lolz O_o :D

I would have left the reply as just a grin, but I dont fancy getting banned or having this thread closed today.

On the brighter side, leech away, Ive got 40Gb/Month of bandwidth, Ive NEVER to date even used 1Gb/Month and they've been hosting me for over a year now :)

@Legoias
Professional PHP, HTML, Java & VB programmer
Enthusiast C++ programmer

:)

\\Fényx//
30-09-03, 16:43
Well ive got a 15 meg net connection at work :) so time to get that bandwith and views number up eh ;) ;) ;) :lol: I tink ill just leave the mouse on the refresh button overnight :lolololol: :p

hinch
30-09-03, 16:43
you do c++ for fun?

thats sick i do it for a living and i hate it

i do vb,vbscript,php,perl,.net for fun :)

fuck im sad

\\Fényx//
30-09-03, 16:45
Originally posted by hinch
you do c++ for fun?

thats sick i do it for a living and i hate it

i do vb,vbscript,php,perl,.net for fun :)

fuck im sad


Then you get home and spend the night playing neocron :(

I do tech support, I tell fucktards how to fix their PC's over the phone and by Email..... Thats why im an ass on the forums lol customers piss me off so i come on here and release some frustration.....




[Edit] I know pascal if that's counted ? Hell I did 3d graphics in pascal o_O The lecturer didnt even think it was possible :lol:

NeoLojik
30-09-03, 16:50
I can do Direct3D in VB, it may not be able to do more than 0.3FPS, but it WORKS :p

@hinch
Yeah, I C++ in my spare time (of which I have little, Neocron IS a drug you know :lol: ).

@fenix
So, YOU'RE the guy who I spoke to when I rang savastore :mad: Damn impatient techs these days :lol: j/k
I do buy alot of PC stuff from there tho, cheap prices and good delivery times (this is NOT an ad).

\\Fényx//
30-09-03, 16:53
Originally posted by NeoLojik
@fenix
So, YOU'RE the guy who I spoke to when I rang savastore :mad: Damn impatient techs these days :lol: j/k
I do buy alot of PC stuff from there tho, cheap prices and good delivery times (this is NOT an ad).




well i doubt it, im on PC support with Joshi, Steve does Tech support which is individual products, I only do our built PC's


yup.... Theres 3 of us on 'Tech support' for a company that sells 35 million quids worth of PC's a year...

:wtf: !!!!! :wtf: !!!!!!


www.savastore.com :lol:ahem o_O

NeoLojik
30-09-03, 17:24
Originally posted by \\Fényx//
well i doubt it, im on PC support with Joshi, Steve does Tech support which is individual products, I only do our built PC's


yup.... Theres 3 of us on 'Tech support' for a company that sells 35 million quids worth of PC's a year...

:wtf: !!!!! :wtf: !!!!!!


*snip* Neo: BAD FENIX!! :lol:ahem o_O Ouch, talk about being spread thin :\

Its just occured to me, there are NO decent free hosts that support PHP anymore :mad:

Ascension
30-09-03, 20:12
Why Not host them of ur host?

stalked monkey
01-10-03, 01:20
www.coolfreepages.com is pretty good, but just a little slow. Stupid though too... if they delete your account (which they just do sometimes) you can just re-apply for the same exact account and visitors will barely notice a burp in service if you do it fast enough.