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.
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.