Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7558239
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T12:19:14+00:00 2026-05-30T12:19:14+00:00

I have developed a class for Minecraft in PHP, one of the most recent

  • 0

I have developed a class for Minecraft in PHP, one of the most recent additions to the functions is a skin preview but I am having a little trouble working out the codes for the full body preview (head preview works fine), the code I am using for the head preview is as follows…

header('Content-Type: image/png');
$canvas = imagecreatetruecolor($size, $size);
$image = imagecreatefrompng($this->custom_skin($username));
imagecopyresampled($canvas, $image, 0, 0, 8, 8, $size, $size, 8, 8);
return imagepng($canvas);

https://github.com/nblackburn/minecraft/blob/master/class.minecraft.php

Any contributions would be a huge help to get this full body preview working.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-30T12:19:15+00:00Added an answer on May 30, 2026 at 12:19 pm

    Have a look at this skin template http://www.minecraftwiki.net/images/5/54/Skintemplate.png

    Based on that the regions should be:

    head        x8 y8 w8 h8 
    body front  x20 y20 w8 h12
    arm front   x44 y20 w4 h12
    leg front   x4 y20 w4 h12
    

    You may need to flip the arm and leg sections in order to get the left and right to be mirrored.

    header('Content-Type: image/png');
    
    $scale = $size / 16;
    $canvas = imagecreatetruecolor(16*$scale, 32*$scale);
    $image = imagecreatefrompng($this->custom_skin($username));
    
    imagealphablending($canvas, false);
    imagesavealpha($canvas,true);
    $transparent = imagecolorallocatealpha($canvas, 255, 255, 255, 127);
    imagefilledrectangle($canvas, 0, 0, 16*$scale, 32*$scale, $transparent);
    
    imagecopyresized($canvas, $image, 4*$scale,  0*$scale,  8,   8,   8*$scale,  8*$scale,  8,  8);  //head
    imagecopyresized($canvas, $image, 4*$scale,  8*$scale,  20,  20,  8*$scale,  12*$scale, 8,  12); //body
    imagecopyresized($canvas, $image, 0*$scale,  8*$scale,  44,  20,  4*$scale,  12*$scale, 4,  12); //arm left
    imagecopyresampled($canvas, $image, 12*$scale, 8*$scale,  47,  20,  4*$scale,  12*$scale, -4,  12); //arm right (flipped)
    imagecopyresized($canvas, $image, 4*$scale,  20*$scale, 4,   20,  4*$scale,  12*$scale, 4,  12); //leg left
    imagecopyresampled($canvas, $image, 8*$scale,  20*$scale, 7,   20,  4*$scale,  12*$scale, -4,  12); //leg right (flipped)
    
    return imagepng($canvas);
    

    The above is just from memory but it should point you in the right direction. You shouldn’t use imagecopyresampled when upscaling since in this case you want to avoid interpolation.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have developed a Jersey Resource class. Can someone please tell me how can
I have a class of encryption that was developed in Microsoft Visual C++ 6.0,
I have developed some reusable android component which is basically a class . This
I have developed a Java Swing application, which uses the SwingWorker class to perform
i have developed one application in that i have to check whether net is
I have developed a little software in ACCESS/VBA. It dealt with Lotus Notes so
I have a class developed in F# that must be serializable. How can I
I have developed a desktop database application. But the interface is not rich. So
I have developed a sample in latest PHP 5.3 and have realized it later
i have developed a simple AsyncTask class that takes Handlers as its parameters and

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.