Cannot get image to display in blade view - Laravel 8
I have an image located in /my_project/public/uploads/avatars/1/testfile.jpg
In my blade view I am trying to show this image but the image won't load and the link is broken.
When I inspect element in browser it is shown as <img src="/uploads/avatars/1/testfile.jpg">
The permission for the folder in Linux are:
drwxr-xr-x 4 www-data www-data 4096 Dec 17 17:50 uploads
The permissions on your uploads folder seem correct, but there are other folders to be considered like the public folder or avatars/1 and also make sure you have the right config for your htaccess on your server, this might help: https://stackoverflow.com/a/51056801/1457270
I would also test:
If you place the image directly in your public folder, is it loading?
@Nakov I have added the .htaccess file out side of my public folder like you mentioned, no luck with that.
I have moved the image directly in my public folder so it's /my_project/public/testfile.jpg
What should the code look like inside the blade view?
Right now I have <img src="/testfile.jpg"/> and it does not load.
Also tried <img src="{{ asset('testfile.jpg') }}"/>