How to Display Image From Storage App Public Folder in Laravel 8


How to Display Image From Storage App Public Folder in Laravel 8

In this tutorial, we will learn how to display an image from storage app public folder in laravel 8. It is very simple.

Also we can display the files or images from the public folder of the laravel application but it is less secure than uploading in the storage directory.

On the other hand, the storage app directory is more robust and secure. So, it is recommended to use the storage filesystems always.

Before accessing a file from the storage folder, we need to upload a file or image inside the storage public folder of the laravel application.

Also Read, How to Upload Image to Storage Folder in Laravel 8

Steps to display image from storage app public folder

  • Create a symbolic link with the help of artisan command as shown below
php artisan storage:link

Now you can check the link inside the filesystems configuration file that exists in the config folder of the laravel application as shown below

'links' => [
        public_path('storage') => storage_path('app/public'),
    ],

We can retrieve all the files that are stored inside the public folder of the storage path.

  • Now, you can access the files or image into the blade file with the help of laravel asset helper as shown below.
{{ asset('storage/filename') }}

Conclusion:- I hope this tutorial will help you to understand the overview of the storage filesystems in laravel 8.


Leave a Reply

Your email address will not be published. Required fields are marked *

Theme of 96 THEME.