aboutsummaryrefslogtreecommitdiffhomepage
path: root/app/Http/Controllers/ImageController.php
blob: 603008d824e78106c63b4a5558c7f95fabe684d0 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
<?php

namespace App\Http\Controllers;

use Illuminate\Http\Request;
use Illuminate\Foundation\Auth\User;
use Intervention\Image\ImageManagerStatic as Image;

class ImageController extends Controller
{
    public function getAvatar($user_id)
    {
        $usersAvatar = User::findOrFail($user_id)->avatar;
        $storagePath = storage_path('app/public/avatars/' . $usersAvatar);
        return Image::make($storagePath)->response();
    }
}