Search code examples
phplaravellaravel-5.5file-storage

Image not retrieving Laravel


I am trying to retrieve the image. I didn't create the symbolic link from public/storage to storage/app/public by php artisan storage:link method. Rather than this, I added this code to App::make('files')->link(storage_path('app/public'), public_path('storage')); to app/providers/AppServiceProvider.php. But still no luck image is not showing and there is also no error.

Code in View:

<img src="/public/storage/{{$main->image_dir}}" /> // /public/storage/main/image.jpg
<img src="/storage/{{$main->image_dir}}" /> // /storage/main/image.jpg
<img src="http://localhost:8000/storage/{{$main->image_dir}}" /> // http://localhost:8000/storage/main/image.jpg

I am not getting image with any of above 3 links. Images are stored here: storage/app/main.


Solution

  • I solved the problem.

    I deleted the folder named public by mistake from storage/app. My images were stored in storage/app/main, in this case, images were not retrieving. Now it is stored in storage/app/public/main and it is working perfectly fine.