Welcome!

Join our community of MMO enthusiasts and game developers! By registering, you'll gain access to discussions on the latest developments in MMO server files and collaborate with like-minded individuals. Join us today and unlock the potential of MMO server development!

Join Today!

PHP Dynamic Image

Status
Not open for further replies.
Newbie Spellweaver
Joined
Apr 21, 2008
Messages
10
Reaction score
0
What is Dynamic image?
Dynamic images are created with php. ;) also u can use Mysql data in it.
And that is why this release is here ^^

What does this release got?
-Automaticly Update [Dynamic] ;)
-Saves the image in the map.

Sample :
UnicornBritt - PHP Dynamic Image - RaGEZONE Forums


UPDATE 2 Got :
-Sig Request Page
-Additional Background
-Additional Text Colors
-Additional Border Colors

UPDATE 2
PHP:
<?php

// Copyrights to UnicornBritt. All rights Reserved.
// Keep the copyrights, unless ur a thief :(
$pagename = 'Your Image ';

function createImage(){
session_start();
$host = "localhost";
$user = "root"; 
$pass = ""; 
$db = "maplestory"; 

$dbhandle = mysql_connect("localhost", "root", "") 
  or die("Unable to connect to MySQL"); 

$selected = mysql_select_db("maplestory",$dbhandle) 
  or die("No data."); 

if(!isset($_GET['name'])){
    die("No Character has filled in.");
}

$name = $_GET["name"];
$background = $_GET['bg'];
$color = $_GET['color'];
$border = $_GET['border'];
$result = mysql_query("SELECT * FROM characters WHERE name='$name'");
$background = ($background.'.png');

//Database
mysql_close($dbhandle);

//Font
$font = 'Arial.ttf'; 

//Startpunt
$y = 50; 

//Grootte
$width = 306; 
$height = 101;  

//Background
$im = imagecreatefrompng($background);

// Kleuren
$white = ImageColorAllocate($im, 255, 255, 255);
$black = ImageColorAllocate($im, 0, 0, 0); 
$red   = ImageColorAllocate($im, 255, 0, 0); 
$blue  = ImageColorAllocate($im, 0,0,255); 
$pink = ImageColorAllocate($im, 255, 142, 238);

// BORDER
if ($border == 'white'){
ImageRectangle($im, 0, 0, $width-1, $height-1, $white);
}
if ($border == 'black'){
ImageRectangle($im, 0, 0, $width-1, $height-1, $black);
}
if ($border == 'red'){
ImageRectangle($im, 0, 0, $width-1, $height-1, $red);
}
if ($border == 'blue'){
ImageRectangle($im, 0, 0, $width-1, $height-1, $blue);
}
if ($border == 'pink'){
ImageRectangle($im, 0, 0, $width-1, $height-1, $pink); 
}



while ($row = mysql_fetch_object($result)) { 	
	
// COLOR TEXTS
if ($color == 'white'){
ImageTTFText($im, 8, 0, 100, $y+($bar_height-21), $white, $font, $row->name. ''); 
ImageTTFText($im, 8, 0, 100, $y+($bar_height+1), $white, $font, $row->level. ''); 
ImageTTFText($im, 8, 0, 100, $y+($bar_height+21), $white, $font, $row->fame. ''); 
}
if ($color == 'black'){
ImageTTFText($im, 8, 0, 100, $y+($bar_height-21), $black, $font, $row->name. ''); 
ImageTTFText($im, 8, 0, 100, $y+($bar_height+1), $black, $font, $row->level. ''); 
ImageTTFText($im, 8, 0, 100, $y+($bar_height+21), $black, $font, $row->fame. ''); 
}
if ($color == 'red'){
ImageTTFText($im, 8, 0, 100, $y+($bar_height-21), $red, $font, $row->name. ''); 
ImageTTFText($im, 8, 0, 100, $y+($bar_height+1), $red, $font, $row->level. ''); 
ImageTTFText($im, 8, 0, 100, $y+($bar_height+21), $red, $font, $row->fame. ''); 
}
if ($color == 'blue'){
ImageTTFText($im, 8, 0, 100, $y+($bar_height-21), $blue, $font, $row->name. ''); 
ImageTTFText($im, 8, 0, 100, $y+($bar_height+1), $blue, $font, $row->level. ''); 
ImageTTFText($im, 8, 0, 100, $y+($bar_height+21), $blue, $font, $row->fame. ''); 
}
if ($color == 'pink'){
ImageTTFText($im, 8, 0, 100, $y+($bar_height-21), $pink, $font, $row->name. ''); 
ImageTTFText($im, 8, 0, 100, $y+($bar_height+1), $pink, $font, $row->level. ''); 
ImageTTFText($im, 8, 0, 100, $y+($bar_height+21), $pink, $font, $row->fame. ''); 
}

// Backupp =D
#ImageTTFText($image, 10, 0, 150, $y+($bar_height-30), $blue, $font, $row->level. ''); 

}

header("Content-Type: image/png"); 

$namethingy = $_GET['name'];	
$outfile= "$namethingy.png";

imagepng($im,$outfile);
}

$name = $_GET["name"];
$result = mysql_query("SELECT * FROM characters WHERE name='$name'");

// Copyrights to UnicornBritt. All rights Reserved.
// Keep the copyrights, unless ur a thief :(
?> 
<title><? echo "Your Image - ".$name;?></title>
<link href="../style.css" rel="stylesheet" type="text/css">
<center>
            <table width="497" border="0" cellpadding="0" cellspacing="0">
              <tr>
                <td>
                  <table width="496" border="0" cellpadding="0" cellspacing="0">
                    <tr>
                      <td width="19" height="33" align="left" background="../images/seo1.gif"></td>
                      <td width="471" height="33" background="../images/seo2.gif" class="td3">
                         <center><?=$pagename.$name?></center>
                      </td>
                      <td width="7" height="33" align="right" background="../images/seo3.gif"></td>
                    <tr>
                      <td height="41" colspan="3" class="mb3">
<?
echo "<br><center><IMG SRC=".createImage()."".$name.".png><br><br>
";
?>
<input type="button" value="Back" onMouseDown="javascript:history.go(-1)">
 </td>
                    </tr>
                    <tr>
                      <td colspan="3"><img src="../images/seo5.gif" width="496" height="4"></td>
                    </tr>
                  </table>
                </td>
              </tr>
            </table>
            </center>

Keep the copyrights, unless ur a thief :(

Setup :
-Unrar on ur webserver.
-*Connect :

* = after ?name= ur name. ex : image.php?name=Unicorn

Usage On a Site
Code:
<img src="http://127.0.0.1/sig/image.php?name=Unicorn">
Usage On Forum
Code:
[img*]http://127.0.0.1/sig/image.php?name=Unicorn">[/img]

Remove the * from [img*]
IP & Name can be changed.

Questions? Bugs? Comments? All are welcome!
 

Attachments

You must be registered for see attachments list
Last edited:
Experienced Elementalist
Joined
Dec 7, 2006
Messages
294
Reaction score
0
Re: [Release] PHP Dynamic Image

Nice one Madamme ;), I'm know 0 at php, so things like this come really handy :)
 
Experienced Elementalist
Joined
Dec 7, 2006
Messages
294
Reaction score
0
Re: [Release] PHP Dynamic Image

Oh I'm sorry, let me correct it :p
 
Newbie Spellweaver
Joined
Sep 14, 2007
Messages
23
Reaction score
0
Re: [Release] PHP Dynamic Image

Wow, I have found my love. She's a php guru just like me!
 
Experienced Elementalist
Joined
Dec 7, 2006
Messages
294
Reaction score
0
Re: [Release] PHP Dynamic Image

If I want to make another background and position the name levle and fame in other places, what do I have to edit?
 
Newbie Spellweaver
Joined
Apr 21, 2008
Messages
10
Reaction score
0
Re: [Release] PHP Dynamic Image

If I want to make another background and position the name levle and fame in other places, what do I have to edit?

As u see $y = 50; is the startpoint
Edit position :
Position :
Code:
ImageTTFText($im, 8, 0, 100, $y+($bar_height-21), $pink, $font, $row->name. ''); 
ImageTTFText($im, 8, 0, 100, $y+($bar_height+1), $pink, $font, $row->level. ''); 
ImageTTFText($im, 8, 0, 100, $y+($bar_height+21), $pink, $font, $row->fame. '');

Focus on :
Code:
$y+($bar_height+21)
+21 = +21 FROM the startpoint.

Think u know it now..

Set +0 or somthing to get THE startpoint.
+50 to get it FAR away. ;)
- is Away from the Startpoint, but then else ;)

BACKGROUND =
Just edit with photoshop and make some bars.
Then edit the position of the texts.
 
Experienced Elementalist
Joined
Dec 7, 2006
Messages
294
Reaction score
0
Re: [Release] PHP Dynamic Image

I got it now, it takes some Maths to do it, atm I'm doing the background at photoshop, ill work with the measures laters ;)
 
Experienced Elementalist
Joined
Apr 13, 2008
Messages
211
Reaction score
0
Re: [Release] PHP Dynamic Image

yay lol nice
i gonna try it
soon
not now
tnx
 
Newbie Spellweaver
Joined
Apr 21, 2008
Messages
10
Reaction score
0
Re: [Release] PHP Dynamic Image

its dont working so well..
and i configed this.
im getting this: cannot show the picture "http://animems.servegame.org/sig/image.php?name=BeYTaR" because she has mistakes.
(translated).
but its making the pic in my DB. how can i fix?


Config Wrong + Ur Server Cannot handle some things.
 
Newbie Spellweaver
Joined
Apr 2, 2008
Messages
83
Reaction score
0
Re: [Release] PHP Dynamic Image

Thanks a lot for this. Very, very cool indeed.
 
Experienced Elementalist
Joined
Apr 2, 2008
Messages
207
Reaction score
0
Re: [Release] PHP Dynamic Image

awseome,thank you.
so how henesys.com connects to nexon database?
 
Newbie Spellweaver
Joined
Apr 21, 2008
Messages
10
Reaction score
0
Re: [Release] PHP Dynamic Image

Lol, Nice try,

But No , it doesnt.

Only ur own server.
 
Experienced Elementalist
Joined
Apr 2, 2008
Messages
207
Reaction score
0
Re: [Release] PHP Dynamic Image

oh,so how does it work? 0.o
 
Newbie Spellweaver
Joined
Apr 6, 2008
Messages
95
Reaction score
0
Re: [Release] PHP Dynamic Image

I got it but it creates the image xP saving it on the sig folder and says
"No se puede mostrar la imagen “ [GM]gogo” porque contiene errores."
"Unabled to show the image “ [GM]gogo” because it haves errors."
 
Newbie Spellweaver
Joined
May 4, 2007
Messages
21
Reaction score
0
Re: [Release] PHP Dynamic Image

Damnit, i wanted to release it :)
 
Newbie Spellweaver
Joined
Apr 4, 2008
Messages
50
Reaction score
0
Re: [Release] PHP Dynamic Image

Kewl, I always asked myself how people did this.
Thx^^
 
Status
Not open for further replies.
Back
Top