PHP code example of mattiabasone / minecraft-skin

1. Go to this page and download the library: Download mattiabasone/minecraft-skin library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

mattiabasone / minecraft-skin example snippets



use MattiaBasone\MinecraftSkin\Flat\Avatar;
use MattiaBasone\MinecraftSkin\Component\Side;

$avatar = new Avatar("/path/to/minecraft-skin.png");

$avatar->render(256, Side::FRONT);

// Get the \GdResource
$resource = $avatar->getResource();
// or as string
$rawImage = (string) $avatar;
file_put_contents("/my/output/file.png", $rawImage);