Advertisement
  1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Solved Help with Skins

Comments in 'Plugin Development' started by MrGenga, Oct 14, 2015.

  1. MrGenga
    Offline

    MrGenga Active Member

    Joined:
    Jul 24, 2015
    Posts:
    75
    Minecraft User:
    MrGenga
    Hi! I have the problem: with the player skins. When I used my skin util: http://mrgenga.tk/skin.php?url=* When I put in it while from @aliuly SkinUtils, I have string with length 5664 ± 5. When I used two for cycles, I have black skin. What the true algorithm to convert png skin to raw format?
  2. MrGenga
    Offline

    MrGenga Active Member

    Joined:
    Jul 24, 2015
    Posts:
    75
    Minecraft User:
    MrGenga
    Is that good code?
    PHP:
    <?php
    error_reporting
    (E_ERROR); //to cancel showing warnings
    $im imagecreatefrompng($_GET['url']); //get image
    if(!$im) {
    echo 
    "fail";
    exit();
    }
    $rgba ""//raw skin

    for($x 0$x <= imagesx($im); $x++) {
    for(
    $y 0$y <= imagesy($im); $y++) {
    $rgb imagecolorat($im$x$y); //get pixel
    $r = ($rgb >> 16) & 0xFF//red
    $g = ($rgb >> 8) & 0xFF//green
    $b $rgb 0xFF//blue
    $rgba .= chr($r).chr($g).chr($b).chr(255); //add 4 bytes to raw skin
    }
    }
    $rgba substr($rgba064 32 4); //if skin in the 1.8 format
    echo $rgba//show raw skin
    ?>
  3. MrGenga
    Offline

    MrGenga Active Member

    Joined:
    Jul 24, 2015
    Posts:
    75
    Minecraft User:
    MrGenga
    But I again have 5000-6000 bytes in raw skin. But 64 * 32 * 4 = 8192.
  4. Primus
    Offline

    Primus Notable Member

    Joined:
    Apr 7, 2015
    Posts:
    1,470
    Minecraft User:
    PrimusLV
    One Man Army.
  5. MrGenga
    Offline

    MrGenga Active Member

    Joined:
    Jul 24, 2015
    Posts:
    75
    Minecraft User:
    MrGenga
    Problem is this: when I copy all text from this page, my browser ignore newline. To fix it for all, I replace \n to \\n(in string), and when I used result, I repplace \\n to \n.
    :D

Share This Page

Advertisement