Comments

limistah

Tue 19 Dec, 2017 12:48 pm
It will be better if we can get some codes to understand what you have done

mrcodes

Tue 19 Dec, 2017 12:58 pm
limistah wrote:
It will be better if we can get some codes to understand what you have done

Well, I can't share codes here cos I'm on mobile. But if anyone has uploaded/stored an image on Laravel using something like
$request->file('photo')->store('images'), you'll notice it uploads into the storage/app/images folder, my question is how do I reference/call this image

limistah

Tue 19 Dec, 2017 01:26 pm
something like:
Code:
$photo= storage_path() . '/avatars/photo';

mrcodes

Tue 19 Dec, 2017 01:40 pm
limistah wrote:
something like:
Code:$photo= storage_path() . '/avatars/photo';
Does the storage_path() method point to the storage/app/images dir

Lefthand

Wed 20 Dec, 2017 01:24 am
Code:
$name=  Storage::disk('local')->put($imagename, file_get_contents($image) )  

use the above code to post to your public folder in the app sub folder which resides in the storage folder. 

Your storage path in your filesystem.php config file should look like this
Code:
'local' => [ 'driver' => 'local', 'root' => storage_path('app/public'),   ],


then create a link from your public folder to the public folder in Storage->app->public
Like so: 
Code:
php artisan storage:link
you can simply do this to fetch the file in your blade template:
Code:
{{asset('storage/imagename.jpg')}};