I have Laravel website saving images viya controller, I uploaded the project on server host, in public_html folder I put public folder files.
other folders and files put on folder outside public_html
/home/domain_user
public_html
|__ images
project_folder
|__app
|__bootstrap
|__ public
|__images
when I save Images it saved in project_folder->public->images
and when i used assets to view images it use images in :public_html->images
save image code :
$image_name=$post->id.'_'.$image_counter.'.jpg';
$image->move(public_path().'/images/posts/', $image_name);
view image code :
$image='images/posts/'.$post->id.'_1.jpg';
<img class="img-fluid" src="{{ asset($image) }}" alt="Third slide">
How can I save and vuew image to and from same path?
2
Answers
I solved it :
You have to change the public folder direction. (default is on laravel/public)
add this code to bootstrap/app.php:
If not works, use second way:
Anyway, it is better to use Storage so that you don’t have these problems.