Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- header("Content-Type: image/png");
- $size = isset($_GET['w']) && is_numeric($_GET['w']) && $_GET['w'] <= 1600 && $_GET['w'] >= 8 ? $_GET['w'] : 100;
- $helm = isset($_GET['h']) && $_GET['h'] == 1 ? true : false;
- // only used when h=1
- $inset = $size / 18;
- $scaled = $size * 8 / 9;
- if(isset($_GET['n'])){
- $url = "http://s3.amazonaws.com/MinecraftSkins/".$_GET['n'].".png";
- } else {
- $url = "http://s3.amazonaws.com/MinecraftSkins/char.png";
- }
- if(getimagesize($url)){
- $image = imagecreatefrompng($url);
- $output = imagecreatetruecolor($size, $size);
- if($helm){
- $output_image = imagecopyresampled($output, $image, $inset, $inset, 8, 8, $scaled, $scaled, 8, 8);
- $output_image_helm = imagecopyresampled($output, $image, 0, 0, 40, 8, $size, $size, 8, 8);
- } else {
- $output_image = imagecopyresampled($output, $image, 0, 0, 8, 8, $size, $size, 8, 8);
- }
- } else {
- $image = imagecreatefrompng("http://s3.amazonaws.com/MinecraftSkins/char.png");
- $output = imagecreatetruecolor($size, $size);
- // Steve has no helm, but make sure the faces are scaled to the same size for custom and non-custom
- // skins when helms are enabled
- if($helm){
- $output_image = imagecopyresampled($output, $image, $inset, $inset, 8, 8, $scaled, $scaled, 8, 8);
- } else {
- $output_image = imagecopyresampled($output, $image, 0, 0, 8, 8, $size, $size, 8, 8);
- }
- }
- imagepng($output);
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement