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">
Related
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
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="">
i am trying to show images which is stored in storage/app/public/directory and i am retreiving the image name with directory from database like 'projects/123456/jpg'. i have tried so many things but failed to show image..
i have tried this
<img id="before" src="<?php echo asset("storage/app/$data->pic_before_project"); ?>" height="100"
width="120">
and also this
<img id="before" src="{{ asset('/'.$data->pic_before_project) }}" height="100" width="120">
but those didnt work... here to mention i have already linked storage.
please help.
from this you can access folder wherever it saved
{{ URL::asset('/public/yourfolder/'.$data->pic_before_project) }}
or try this
{{ asset('yourfolder/'.$data->pic_before_project) }}
last code automatically access public folder when you are in localhost first one is using in hosting
I solved my problem. just to share, the problem might occur when you are using an existing project where public/storage file is already linked. so deleteing the storage folder and then again linking the storage with php artisan storage:link command worked for me..
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'); }}" />
Symfony gets on my nerves...
I'm desperatly trying to display an image using the following codes and commands :
{% image 'EC/myBundle/Resources/public/images/my-image.jpg' %}
<img src="{{ asset_url }}" alt="Example" />
{% endimage %}
or
<img src="{{ asset( 'images/my-image.jpg' ) }}" />
with
php bin/console assets:install
or with
php bin/console assetic:watch
or with
php bin/console assetic:dump --env=dev
I've been trying everything but it doesn't work at all.
(However, CSS and JavaScript do work (using the proper tag).)
I don't understand where the problem comes from.
Thank you for your help.
Try something like this :
img src="/bundles/app/images/logo.png"
and make sure the file exists in the web folder