mirror of
https://github.com/bs-community/blessing-skin-server.git
synced 2025-01-24 14:04:07 +08:00
generate avatar from default steve skin instead of outputting static image
This commit is contained in:
parent
f807aa879c
commit
0dc2ecd566
Binary file not shown.
Before Width: | Height: | Size: 897 B |
File diff suppressed because one or more lines are too long
@ -3,7 +3,7 @@
|
||||
* @Author: printempw
|
||||
* @Date: 2016-01-16 23:01:33
|
||||
* @Last Modified by: printempw
|
||||
* @Last Modified time: 2016-04-03 21:44:11
|
||||
* @Last Modified time: 2016-04-03 22:14:39
|
||||
*/
|
||||
|
||||
class Utils
|
||||
@ -165,13 +165,14 @@ class Utils
|
||||
* Cut and resize to get avatar from skin, HD support by <xfl03@hotmail.com>
|
||||
*
|
||||
* @author https://github.com/jamiebicknell/Minecraft-Avatar/blob/master/face.php
|
||||
* @param string $hash
|
||||
* @param string $resource, img path or base64
|
||||
* @param int $size
|
||||
* @param string $view, default for 'f'
|
||||
* @param bool $base64, if given $resource is encoded in base64
|
||||
* @return resource
|
||||
*/
|
||||
public static function generateAvatarFromSkin($hash, $size, $view='f') {
|
||||
$src = imagecreatefrompng(BASE_DIR."/textures/$hash");
|
||||
public static function generateAvatarFromSkin($resource, $size, $view='f', $base64 = false) {
|
||||
$src = $base64 ? imagecreatefromstring(base64_decode($resource)) : imagecreatefrompng($resource);
|
||||
$dest = imagecreatetruecolor($size, $size);
|
||||
$ratio = imagesx($src) / 64; // width/64
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user