'images do not display in Laravel 8
am trying to store images in storage folder in Laravel 8 and at the same time fetch that image and displays it in browser, unfortunately, the images get saved but do not display
here is my file
<?php
namespace App\Http\Controllers;
use Illuminate\Http\Request;
use Intervention\Image\Facades\Image;
class PostsController extends Controller
{
public function __construct()
{
$this->middleware('auth');
}
public function create(){
return view('posts.create');
}
public function store(){
$data = request()->validate([
'caption' => 'required',
'image' => ['required','image']
]);
$imagePath = request('image')->store('uploads','public');
$image = Image::make(public_path("{C:\xampp\htdocs\app\storage\app\public\uploads\
{$imagePath}"))->fit(1000,1000);
$image->save();
dd($imagePath);
auth()->user()->posts()->create([
'caption' => $data['caption'],
'image'=>$imagePath,
]);
return redirect('/profile/'. auth()->user()->id);
}
public function show(\App\Models\Post $post){
return view('posts.show', compact('post'));
}
}
any help guys
Solution 1:[1]
There are also predefined exit codes EXIT_SUCCESS and EXIT_FAILURE
#include <stdlib.h>
...
exit(0);
...
e.g. exit(EXIT_SUCCESS);
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 |
