Oh no! Where's the JavaScript?
Your Web browser does not have JavaScript enabled or does not support JavaScript. Please enable JavaScript on your Web browser to properly view this Web site, or upgrade to a Web browser that does support JavaScript.
Not a member yet? Click here to register.
Forgot Password?

I want to make avatars default to minecraft skin

Asked Modified Viewed 2,069 times
P
Penguinish
P
  • Junior Member, joined since
  • Contributed 24 posts on the community forums.
  • Started 6 threads in the forums
  • Started this discussions
asked
Junior Member

Ok I have a script that will render a players minecraft player skins face. I want to display as the avatar by using a custom user fields input as the username for this skin. In this case im using the real name user field tweaked to ask for the players minecraft user name. $real_name is the input for that.
Here is the script:
<?php
    header('Content-Type: image/png');
     
    $player_name = 'wide_load';
    $width = 200;
    $height = 200;
     
    $cache_file = "cache/player_skins/faces/{$player_name}_{$width}x{$height}.png";
     
    if (!file_exists($cache_file) || time() - filemtime($cache_file) > 86400){
            $skin = imagecreatefromstring(file_get_contents("http://s3.amazonaws.com/MinecraftSkins/{$player_name}.png"));
           
            $face = imagecreatetruecolor($width, $height);
           
            imagecopyresized($face, $skin, 0, 0, 8, 8, $width, $height, 8, 8);
            imagecopyresized($face, $skin, 0, 0, 40, 8, $width, $height, 8, 8);
           
            imagepng($face, $cache_file);
    }
     
    readfile($cache_file);
?>


basically what ever is in the user field $real_name I want the system to place it in $player_name so it renders the face. I then want this to become the default avatar.

How can I do this?

Merged on Jan 17 2013 at 23:04:34:
Sorry to bump but this is one (huge) feature I need to have on my site. I have no idea where to begin on making an avatar render based off a userfield.
Edited by Penguinish on 18-01-2013 00:04,
0 replies
There are no post found.

Labels

None yet

Statistics

  • Views 0 views
  • Posts 0 posts
  • Votes 0 votes
  • Topic users 1 member

1 participant

P
P
  • Junior Member, joined since
  • Contributed 24 posts on the community forums.
  • Started 6 threads in the forums
  • Started this discussions

Notifications

Track thread

You are not receiving notifications from this thread.

Related Questions

Not yet