irankhosravi
1 month ago
274
12
Laravel

How to show image from storage in laravel?

Posted 1 month ago by irankhosravi

My folder is storage\app\images\categories\FILE_NAME.

I want to show an image in blade

@if (isset($category->image))
    <img src="{{ asset("storage/{$category->image}") }}" class="img-fluid cursor-pointer">
@else
    <img src="{{ asset('images/categories/images.jpg') }}" class="img-fluid cursor-pointer">
@endif

I see this dem.

storage

config/filesystems.php

'disks' => [

    'local' => [
        'driver' => 'local',
        'root' => storage_path('app'),
    ],

    'public' => [
        'driver' => 'local',
        'root' => storage_path('app/public'),
        'url' => env('APP_URL').'/storage',
        'visibility' => 'public',
    ],

    's3' => [
        'driver' => 's3',
        'key' => env('AWS_ACCESS_KEY_ID'),
        'secret' => env('AWS_SECRET_ACCESS_KEY'),
        'region' => env('AWS_DEFAULT_REGION'),
        'bucket' => env('AWS_BUCKET'),
        'url' => env('AWS_URL'),
    ],

],

Please sign in or create an account to participate in this conversation.