PHP Character Image Generator

Newbie Spellweaver
Joined
Apr 16, 2008
Messages
10
Reaction score
0
Here is an image generator script for you all to use. Its quite easy to setup, given your server has the GD image extension of php and can support PNG. Most setups of php come with it preinstalled.

This script is not an entire ranking script, it is the image generator only. It takes get data parameters, and some examples of what it outputs are below:

SophNMS - PHP Character Image Generator - RaGEZONE Forums


The background can be edited by the user. The defaults are white and black respectively. These are named bg and bg2 and are .PNG. Feel free to edit them, change the size etc and even add your own background.

All I ask is that you keep my copyright in the top of the script.



Installing the Script

This is very easy. Just extract the archive as it is to where you want the script to be (preferrably in the web root folder), and then you are ready to go! I packed all the neccessary files in there.

Customisation - Font

If you need to change the font for the script search for this line:

Code:
  imagefttext($image, 20, 0, 110 + $glox, 85 + $gloy,  $c1,'aggstock2.ttf' , 'GM');

And this one:

Code:
  // WRITE CHAR NAME
  imagefttext($image, 20, 0, 75 + $glox, 55 + $gloy,  $c1,'aggstock2.ttf' , $gj);

And replace the aggstock2.ttf with the font file you want to use. Just make sure the font file is in the same place as the font. I'll make this easier in a newer revision by making a variable which has the font name in it instead of having to change each part manually.

Customisation - Font Colours

If you need to change the colours for the fonts, look for these lines and change them respectively for the BG they represent:

BG = 0
Code:
  if ($_GET['bg'] == '0') {
    $im = imagecreatefrompng("images/bg.png");
    $image = $im;

    // TEXT COLOUR
    $c1 = imageColorAllocate($image, 0, 0, 0);

Change the values in the imageColorAllocate to the R/G/B values you need.

BG = 1
Code:
  } else {
    $im = imagecreatefrompng("images/bg2.png");
    $image = $im;

    // TEXT COLOUR
    $c1 = imageColorAllocate($image, 255, 255, 255);
  }

Change the values in the imageColorAllocate to the R/G/B values you need.



Using the Script

To use the script simply place an image tag in your page like so:

Code:
<img src="char.php?h=31526&e=21604&w=1702136&a=1002568&c=1102096&t=1042056&b=1061007&g=1082162&s=1072186&acc=1032020&acc2=0&acc3=0&n=Soph&j=SuperGM&bg=0">

Now this looks like a mess, but I'll explain. The script is using GET data to make it suitable for any purpose. It isn't tied to a database so it is compatible with anything.

I'll break down each parameter below:

h=31526 - Hair ID
e=21604 - Eye ID
w=1702136 - Weapon ID
a=1002568 - Hat ID
c=1102096 - Cape ID
t=1042056 - Top/Overall ID
b=1061007 - Bottom ID
g=1082162 - Glove ID
s=1072186 - Shoes ID
acc=1032020 - Accessory 1 (Eye/Ear/Face) ID
acc2=0 - Accessory 2 (Eye/Ear/Face)
acc3=0 - Accessory 3 (Eye/Ear/Face)
n=Soph - Name
j=SuperGM - Job - This needs to be written like this. You can change the names yourself by renaming the job images respectively. GM cannot be changed unless you edit the script though.
bg=0 - Background image - 0 or 1 for the image to use.

There are also some things you can change, I'll quote the code below:

Code:
  // DATA FOLDER LOCATION
  $ddir = 'images/character/alldata/';

  // IMAGE FOLDER LOCATION
  $idir = 'images/character/images/';

  // GLOBAL POSITIONING OFFSET

  $glox = 10;
  $gloy = 30;

Note: The data folder location refers to the location with all the .nms files in it. These contain the offsets for the images. (The .txt files in there are for hair and are also required)

If there is anything I have forgotten to add in this, or you have any questions feel free to ask me.

~Soph
 
Last edited:
Re: [Release] PHP Character Image Generator

Awesome =D
However, i have to ask, how hard would it be to change the font, i would like to know the name of the font you used there....
I can crl+f it from there ;D
 
Re: [Release] PHP Character Image Generator

Awesome =D
However, i have to ask, how hard would it be to change the font, i would like to know the name of the font you used there....
I can crl+f it from there ;D

Try searching "font"? o.o

Or try looking at the top of the page, usually it sais there, I haven't downloaded it yet though
 
Re: [Release] PHP Character Image Generator

Awesome =D
However, i have to ask, how hard would it be to change the font, i would like to know the name of the font you used there....
I can crl+f it from there ;D

Font changing is extremely easy. look for aggstock2.ttf in the file and just change that. You'll need to download / copy the font file itself into the same place as the script though.
 
Re: [Release] PHP Character Image Generator

Yeah, i have a bunch of cool fonts i found, and wanted to experiment .
Thank you for the tip!
 
Re: [Release] PHP Character Image Generator

and people complain about rapidshare....
I'm gonna try to get this to associate with rankings...
Either using stupid php echo for the links or editing everything so the script will retrieve according to name which needs some additions.
 
Re: [Release] PHP Character Image Generator

May i know where do i paste this? <img src="char.php?h=31526&e=21604&w=1702136&a=1002568&c=1102096&t=1042056&b=1061007&g=1082162&s=1072186&acc=1032020&acc2=0&acc3=0&n=Soph&j=SuperGM&bg=0" My ranking script has many lines in it.. where do i paste it?
 
Re: [Release] PHP Character Image Generator

and people complain about rapidshare....
I'm gonna try to get this to associate with rankings...
Either using stupid php echo for the links or editing everything so the script will retrieve according to name which needs some additions.

Good luck. I didn't do that myself because I wanted to ensure it could be integrated into any server by whoever, not to mention that Ninja isn't using any of the public sources. Would be pretty useless if I released it with integration into Ninja now wouldn't it? =P
 
Re: [Release] PHP Character Image Generator

It will be great if there is a guide on how to use it....After extracting all the files to my website folder, what should i do??
 
Re: [Release] PHP Character Image Generator

It will be great if there is a guide on how to use it....After extracting all the files to my website folder, what should i do??

Read the first post. I explained how to use it. The part which I am not explaining is how to integrate it into various servers. Thats for you to do. Its simple enough anyway.
 
Re: [Release] PHP Character Image Generator

:D Soph, just Pm me if you need any help. This is what I got

 
Re: [Release] PHP Character Image Generator

There is a guide on using it xkuromi.
Now this looks like a mess, but I'll explain. The script is using GET data to make it suitable for any purpose. It isn't tied to a database so it is compatible with anything.

I'll break down each parameter below:

h=31526 - Hair ID
e=21604 - Eye ID
w=1702136 - Weapon ID
a=1002568 - Hat ID
c=1102096 - Cape ID
t=1042056 - Top/Overall ID
b=1061007 - Bottom ID
g=1082162 - Glove ID
s=1072186 - Shoes ID
acc=1032020 - Accessory 1 (Eye/Ear/Face) ID
acc2=0 - Accessory 2 (Eye/Ear/Face)
acc3=0 - Accessory 3 (Eye/Ear/Face)
n=Soph - Name
j=SuperGM - Job - This needs to be written like this. You can change the names yourself by renaming the job images respectively. GM cannot be changed unless you edit the script though.
bg=0 - Background image - 0 or 1 for the image to use.
So basically its no ranking at all! You can make your own signature generator with this or character simulator anything!
BUT THIS IS THE CORE Link...
[HAIRID]&e=[EYESID]&w=[WEPID]&a=1002568&c=1102096&t=1042056&b=1061007&g=1082162&s=1072186&acc=1032020&acc2=[Accessory2ID]&acc3=[Accesory3ID]&n=[CharacterName]&j=SuperGM&bg=0
You have to edit those values to see a difference like h is hair so you basically change the 31526 to the hair you want and go to the link. Its simple really but to integrate it to ranking thats a different story which i do not have time to explain.
Sorry i did not cover some of the id thingy but you get the point :)
 
Back