Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

Khin Zin Zin Thinn's avatar

Images Not Showing From Storage Even After Running php artisan storage:link

Hello, I am not able to show the image from the storage folder. I tried accessing the image from public folder and it's working fine.

But the image from public/storage/my-images/example.png displays 404 Error. I already run the 'php artisan storage:link' command as well.

0 likes
3 replies
bobbybouwmann's avatar

What path are you trying to use to access the image? Can you show some code on how you accomplish this?

Khin Zin Zin Thinn's avatar

@bobbybouwmann In Controller

$destination_path = 'public/images/profile-pictures/';
            $profile_picture = $request->file('profile_picture');
            $profile_picture_name = $user->username . '.' . $profile_picture->getClientOriginalExtension();

            $profile_picture_url = 'storage/images/profile-pictures/' . $profile_picture_name; // to use in img src

            $profile_picture->storeAs($destination_path, $profile_picture_name);

In View

<img src="{{ auth()->user()->profile_picture ? asset(auth()->user()->profile_picture) : asset('/storage/images/profile-pictures/default.jpeg') }}"
                        alt="{{ auth()->user()->name }}">
Cakra's avatar

@Khin Zin Zin Thinn assuming you are using local driver. When retrieving assets from storage, use Storage facade like so $url = Storage::url('file.jpg'), your code should be like this

<img src="{{ auth()->user()->profile_picture ? Storage::url(auth()->user()->profile_picture)) : Storage::url('images/profile-pictures/default.jpeg') }}"
                        alt="{{ auth()->user()->name }}">

Please or to participate in this conversation.