Hello, I currently use the 64bit encoder on the base64_encode php system, and after I test on pocketmine I saw that there is a difference of site and pocketmine encoders, for example I tested the code using pocketmine with a png skin, and after doing that, even in any other encoder site 64 it gets another totally different code, it's as if the pocketmine did not use the correct encoder. All the sites that I tested result in the same coded encoder, except the Pocketmine anyone could help me about it? How can I decode a 64bit code on a website exactly the same as the pocketmine encoder? If you don't understand correctly, please ask here and i will tell examples of this.
Can you show examples? Please make sure you are working on the same file, and you aren't encoding the filename instead of the file contents. Also make sure the websites you try on did not preprocess the file before encoding it.
For example, i have on my database a base64_encode($player->getSkin()->getSkinData()); and when i do base64_decode(table_of_skin); on pocketmine, the skin works correctly on a NPC, but noow... i am trying to decode this skin table to an website, like to show the image of the decoded skin for website in php but when i try to decode this encoded skin on my database, it doesn't work, just don't work you can look out by this encoded skin: https://pastebin.com/ZLb17nDP
I believe $player->getSkin()->getSkinData() returns the skins data not an image. Try adding an image attribute with the data set to the base64 encoded skin data ex) PHP: <img src="data:image/gif;base64<?php echo $encoded_skin ?>">
It has an way to get the image of the skin of a player on pocketmine? Whitout encoded or anyway? Did anyone know?
I think this should work PHP: <?php//pocket mine partpublic function saveSkin(Player $player) { $skin = $player->getSkin(); $data = $skin->getSkinData(); $compressed = zlib_encode($data, ZLIB_ENCODING_DEFLATE, 9); //save $compressed to file or database}//site part$skin_zlib = 'zlib string here';$skin_raw = zlib_decode($skin_zlib);$img = @imagecreatefromstring($skin_raw);$png = imagepng($im);
Yep that should work, I wouldn't reccomend storing data like that. I suggest using a web storage service such as AWS S3 to store the images and just retireve them when a user requests the page.
You shouldn't store large amounts of data such as raw file data (in this case the skin data) in a database unless you abseloutely have to, everytime someone visits the page your database is queried and that data is retrieved. If your site is getting large amounts of traffic it will greatly slow PHP, your site, and your database down.
Oh, i did not know that, i just want to do that to get the face of the skin from a player, like https://cravatar.eu/helmavatar/Steve/32 but they got the skin file from mojang data right? So.. how can i do that for mcpe to get the image profile from a nickname of Xbox Live? Or the skin of the game.. It is possible?
This might work (not sure): PHP: <?php//insert previous code I sent$size = 48;$im = imagecreatefromstring($skin_raw);$av = imagecreatetruecolor($size, $size);imagecopyresized($av, $im, 0, 0, 8, 8, $size, $size, 8, 8);imagecolortransparent($im, imagecolorat($im, 63, 0));$png = imagepng($av);
True but the process of storing raw image data, fetching it, converting it to a png/jpg takes longer than fetching it from a service like S3.
Hello, i am back on this thread because i want to ask if it's possible to create a png image on pocketmine? I have tryed to do on window but i receive this error: Call to undefined function leohardu\imagecreatefromstring()