Return avatar without cache
This commit is contained in:
parent
eec2832116
commit
dac2c32ff4
|
|
@ -214,21 +214,17 @@ class TextureController extends Controller
|
|||
$hash = $player->getTexture('skin');
|
||||
if (Storage::disk('textures')->has($hash)) {
|
||||
$key = "avatar-{$hash}-{$size}";
|
||||
$content = Cache::rememberForever($key, function () use ($hash, $size) {
|
||||
$png = Minecraft::generateAvatarFromSkin(
|
||||
Storage::disk('textures')->read($hash),
|
||||
$size
|
||||
);
|
||||
ob_start();
|
||||
imagepng($png);
|
||||
$image = ob_get_contents();
|
||||
ob_end_clean();
|
||||
imagedestroy($png);
|
||||
$png = Minecraft::generateAvatarFromSkin(
|
||||
Storage::disk('textures')->read($hash),
|
||||
$size
|
||||
);
|
||||
ob_start();
|
||||
imagepng($png);
|
||||
$image = ob_get_contents();
|
||||
ob_end_clean();
|
||||
imagedestroy($png);
|
||||
|
||||
return $image;
|
||||
});
|
||||
|
||||
return response($content)->withHeaders(['content-type' => 'image/png']);
|
||||
return Response::png($image);
|
||||
}
|
||||
|
||||
return abort(404);
|
||||
|
|
|
|||
|
|
@ -305,10 +305,9 @@ class TextureControllerTest extends TestCase
|
|||
$this->get("/avatar/player/1/{$player->name}.png")->assertNotFound();
|
||||
|
||||
// Success
|
||||
Storage::disk('textures')->putFileAs(
|
||||
'.',
|
||||
UploadedFile::fake()->image('avatar.png', 64, 64),
|
||||
$texture->hash
|
||||
Storage::disk('textures')->put(
|
||||
$texture->hash,
|
||||
file_get_contents(resource_path('assets/src/images/textures/steve.png'))
|
||||
);
|
||||
$this->get("/avatar/player/20/{$player->name}.png")
|
||||
->assertSuccessful();
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user