app\models\Player::getBinaryTexture PHP Method

getBinaryTexture() public method

Get binary texture by type.
public getBinaryTexture ( string $type ) : Illuminate\Http\Response
$type string steve|alex|cape
return Illuminate\Http\Response
    public function getBinaryTexture($type)
    {
        if ($this->getTexture($type)) {
            $hash = $this->getTexture($type);
            $path = storage_path("textures/{$hash}");
            if (Storage::disk('textures')->has($hash)) {
                // Cache friendly
                return Response::png(Storage::disk('textures')->get($hash), 200, ['Last-Modified' => $this->getLastModified(), 'Accept-Ranges' => 'bytes', 'Content-Length' => Storage::disk('textures')->size($hash)]);
            } else {
                throw new NotFoundHttpException(trans('general.texture-deleted'));
            }
        } else {
            throw new NotFoundHttpException(trans('general.texture-not-uploaded', ['type' => $type]));
        }
    }