Skip to content

Commit

Permalink
improv: fix #44 skins display
Browse files Browse the repository at this point in the history
  • Loading branch information
Eywek committed May 13, 2018
1 parent c1c7e3c commit 9bdb467
Showing 1 changed file with 4 additions and 9 deletions.
13 changes: 4 additions & 9 deletions app/Controller/Component/APIComponent.php
Original file line number Diff line number Diff line change
Expand Up @@ -77,9 +77,9 @@ private function _getSkinFromUsername($username) {
}

private function _getSkinImage($username) {
if ($this->config['skins']) {
$filename = str_replace('{PLAYER}', $name, $config['skin_filename']);
$content = file_get_contents(WWW_ROOT . $filename . '.png');
if ($this->skin_active) {
$filename = str_replace('{PLAYER}', $username, $this->config['skin_filename']);
$content = @file_get_contents(WWW_ROOT . $filename . '.png');
} else {
$content = base64_decode(Cache::read('skin_'.$username, 'skin'));

Expand Down Expand Up @@ -173,12 +173,7 @@ public function get_head_skin($username, $size = 50)
}
$final = imagecreatetruecolor($size, $size);
imagecopyresized($final, $dest, 0, 0, 0, 0, $size, $size, 8, 8);
if ($cache) {
imagepng($final, $cachePath);
include($cachePath);
} else {
imagepng($final);
}
imagepng($final);
imagedestroy($dest);
imagedestroy($final);
}
Expand Down

0 comments on commit 9bdb467

Please sign in to comment.