I am storing images in storage/app/public directory of laravel project.
Also I am saving names of images in the phpmyadmin database if it could be somehow helpful.
Now I want to display those images in my jsx like:
<div className={"dashboard-cards-cardsContainer"}>
{
this.state.images.map((image) =>
<img key={image.id} src={asset("storage/image.name")}/>
)
}
</div>
I already tried:
<img key={image.id}
src={'http://localhost:8000/storage/app/'+image.name}}/>
<img key={image.id}
src={'localhost:8000/storage/app/public'+image.name}}/>
<img src={'../../../../../storage/app/public'+image.name} alt=""/>
The only time I was able to display image was when I was importing them from public folder
import photo from '../../../../../public/assets/cards/card-1.png';
however my images are in laravel storage but I just don't how to access it from react, I already tried:
import img from '../../../../../storage/app/public/card51564153446.jpeg';
//via storage symlink
import foto from '../../../../../public/storage/card51564153446.jpeg';
How to I access laravel storage via react ?