Jump to content
MakeWebGames

Recommended Posts

Posted

This module puts the users stats into a image which could be used on image boards, websites etc.

This could be modified to your own liking. This is just the base code.

 

Make a file called StatsImage in modules and within that folder make a index.php file

/modules/StatsImage/index.php

<?php
//Made by 21lockdown
//http://www.ezrpgproject.com/forum/
//http://unholy-kingdom.com
defined('IN_EZRPG') or exit;
class Module_StatsImage extends Base_Module
{
   public function start()
   {
$website = "http://unholy-kingdom.com";
//Change this to change the images dimensions. Default is 530 x 15
$img = imagecreate( 530, 15 );
$background = imagecolorallocate( $img, 0, 0, 255 );
$text_colour = imagecolorallocate( $img, 255, 255, 0 );
$line_colour = imagecolorallocate( $img, 128, 255, 0 );
//$fontsize = 30;
//Selecting the user from the database
$player = $this->db->fetchRow('SELECT * FROM `<ezrpg>players` WHERE `username`=?', array($_GET['member']));
//Displaying the text that has been retrieved from the database.
$text = "$player->username[$player->id] | Level = $player->level | Gold = $player->money | Diamonds = $player->diamonds | $website";

//$font = imageloadfont('static/fonts/visitor2.ttf');

//Writes the string. Parameters are image,font,x,y,string,color
imagestring( $img, 2, 20, 0, $text, $text_colour);

//Creates the image
header( "Content-type: image/png" );
imagepng( $img );
imagedestroy( $img );
   }
}
?>

 

The url used to get a users picture would be -

http://youwebsite.com/index.php?mod=StatsImage&member=*USERNAMEHERE*

 

You could add a link to it by adding this -

<a href="index.php?mod=StatsImage&member={$player->username}">

or iframing it

<iframe src="index.php?mod=StatsImage&member={$player->username}" width="530" height="15"></iframe>

 

Screenshot ->

screenshot2011042616295.png

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...