My laravel doesn't show image though sybolic link is right - laravel

I typed php artisan storage:link and below is my symbolic link.
ls -la public
storage -> /home/arosotomakas/Desktop/recipehouse_laravel/storage/app/public
This is a screenshot of my public and storage directory.
And Below are codes for the display function.
<img src="{{ asset('storage/'. $recipe->file_path) }}">
<img src="{{ asset('storage/tesuto1.png') }}">
<img src="{{ asset('public/storage/tesuto1.png') }}">
<img src="../../../storage/{{$recipe->file_path}}" alt="recipe image">
This is my console error in developer tool.
Where is the wrong in my setting?
Thank you for your help.

I had to type ./vendor/bin/sail php artisan storage:link.
I accidentally typed php artisan storage:link

Related

Laravel image doesn't display

I'am using this code to display the image
#foreach($Phones as $clothe)
#if($clothe->category=='Phones')
<div class="card" style="width: 300px; display:inline-block; margin:20px;">
<img class="card-img-top" src="{{ URL::asset('storage/images/'.$clothe->image)}} " width="100%"/>
the picture exist on storage\app\public\images but it doesn't display on my page, btw i've made the php artisan storage:link
For those who are having the same problem as me here is what to do :
delete the folder storage on public and retype the command "php artisan storage:link"
add src="/ and give it a try
check image available in folder ProjectName/public/storage/images/a30_1606210965.jpg
read this artical/link...
https://www.itsolutionstuff.com/post/how-to-display-image-from-storage-folder-in-laravelexample.html
from above article
<img src="{{ asset('/images/'.$clothe->image) }}" alt="" title="">
Following code is working fine on my side.
.env
FILESYSTEM_DRIVER=public
Php artisan config:clear
Upload image code
$request->file('image')->store('image');
blade file
<img src="{{ asset('storage/'.$clothe->image) }}" alt="" title="">

How to fetch images from storage folder from an add-on-domain in laravel?

I have an add-on-domain as public_html/xyz.in. I am uploading images and images are getting stored inside storage/app/public/images folder. However when I am trying to fetch images from that folder, its showing 404 not found. Please help.
<img src="{{ asset('storage/app/public/images/tulips.jpg') }}">
The folder storage is not available to visitors. That's why you need to create a symbolic link from the public directory.
You can use artisan, to get a symbolic link
php artisan storage:link
You need to create a symbolic link of your storage folder. i.e storage/app/public to public/storage. if you have SSH access you can use php artisan storage:link as #wschopohl suggested. Else you can create a php script to create that symlink.
<?php
$target = '/home/user/domain/storage/app/public';
$shortcut = '/home/user/domain/storage';
symlink($target, $shortcut);
?>
After running you can see storage folder in your public folder. Now you can access image with <img src="{{ asset('storage/folder_name/image_name.jpg') }}">
You can create a storage link. run bellow command :
php artisan storage:link
And display:
<img src="{{ asset('public/storage/templates/image.png') }}" class="img img-thumbnail">
Read a full post: How to display the storage folder image in Laravel

Not able to display images in blade template

I have Image in public/storage/images directory. I am accessing them with the asset()
<img src="{{ asset('/storage/images/img_1.jpg') }}" alt="Image" class="img-fluid">
But they are not getting displayed.
have you created the symbolic link? If not you can do so by running the command below.
php artisan storage:link
For further information, do refer to the official documentation
Try to use the following, if your image in the asset folder.
<img src="{{ asset('/images/img_1.jpg') }}" alt="Image" class="img-fluid">

Laravel 5.8 how to display image from storage? My Git added

https://github.com/Loctarogar/Admipanel-to-manage-companies/tree/master/storage/app My git.
I linked storage to public directory with
php artisan storage:link,
but i can't show images from there. If i use
<img src="{{ asset ('storage/app/avatars/LOW6Fc2TBH8UoexcXLntQkzncXSDN6OsIt7KLbiG.jpeg') }}">
image doesn't shows. What i am do wrong?
That creates a symlink from public/storage to storage/app/public for you and that's all there is to it. Now any file in /storage/app/public can be accessed via a link like:
http://somedomain.com/storage/image.jpg
OR
One option would be to create a symbolic link between a subfolder in your storage directory and public directory.
For example
ln -s /path/to/laravel/storage/avatars /path/to/laravel/public/avatars
You forgot to enter in the public folder that storage:link creates...
Change
<img src="{{ asset ('storage/app/avatars/LOW6Fc2TBH8UoexcXLntQkzncXSDN6OsIt7KLbiG.jpeg') }}">
to:
<img src="{{ asset ('storage/app/public/app/avatars/LOW6Fc2TBH8UoexcXLntQkzncXSDN6OsIt7KLbiG.jpeg')}}">

Laravel 5.5 image is not showing from storage/app

I am using laravel 5.5. I have a form to upload image. Those images are storing into the storage/app folder. It is working fine. But when I try to show those images. Those are not showing.
I have tried with those ways to print my images.
<img src="{{ asset('storage/1539872957.a-nice-place-to-picnic.jpg')}}" alt="">
<img class="user_avatar" src="{{ url('storage/app/1539872897.IMG_20180804_120323.jpg') }}">
<img class="user_avatar" src="<?php echo asset('storage/1539455504.prakruth-resort.jpg');?>">
Here I am giving image name as static name just for checking.
I have also done php artisan storage:link and a shortcut folder named 'storage' is created in the public folder. But still images are not showing.
i think this Answer would help you.
you will have to create symlink from public/storage to storage/app/public first through this command
`php artisan storage:link`
Now any file in /storage/app/public can be accessed via a link like:
http://somedomain.com/storage/image.jpg
In your Controller use public driver like this:
\Storage::disk('public')->put('file.png',file_get_contents($request->file->getRealPath()));
the above file.png would be stored in 'public/storage'.
now you can access the image file like this:
<img src="{{ asset('storage/file.png'); }}" />

Resources