Storage Path change
Hi guys, so im trying to get an uploaded image name into a blade file, im currently using this :
<img src="{!! Storage::url('uploads/public.jpg'); !!}">
But the URL being posted is :
<img src="/storage/uploads/public.jpg">
BUT, i need it to be just
<img src="/uploads/public.jpg">
How would i go around changing the path?
Many thanks!
Storage is private. You need to be storing the images in the public folder, or create a symbolic link from a folder in public to a folder in storage.
The files are uploaded to /public/uploads/user_id
But when i use the Storage::url tag, it provides the URL for me which is /storage/
In that case, you have the asset() or url() helper functions available to you.
<img src="{!! asset('uploads/public.jpg') !!}">
Thankyou :)
So if i wanted to include the username in there as well, example test_user so the tag would be :
<img src="{!! asset('uploads/test_user/public.jpg') !!}">
How would i do that? Normally calling a username i use {!! Auth::user()->username !!} but thats not going to work in this case, is it? :-\
Thanks again!
Sorted it! :)
$foldername = Auth::user()->username;
<img src="{!! asset('uploads/' .$foldername. '/profile.jpg') !!}">
Please or to participate in this conversation.