Display an image
i have this controller that saves th image path into a database
class UploadController extends Controller
{
public function profile()
{
return view ('upload');
}
public function upload_image(Request $request){
$this->validate($request,[
'image' => 'required']);
$upload = new Upload;
// $upload-> id = Auth::user()->id;
// $profiles-> name = Auth::user()->name;
// $profiles-> email = Auth::user()->email;
// $profiles-> password = Auth::user()->password;
// $profiles-> remember_token = Auth::user()->remember_token;
if(Input::hasFile('image')) {
$file = Input::file('image');
$file->move(storage_path() . '/uploads/', $file->getClientOriginalName());
$url = URL::to("/") . '/uploads/' . $file->getClientOriginalName();
}
$upload-> file_name = $url;
$upload->save();
return redirect('/upload')-> with ('response','Profile Added successfully');
}
}
how can i display the img?
<img src="{{}}"
Be sure to create a Symbolic link
php artisan storage:link
Now you can access you image @ http://somedomain.com/storage/image.jpg
You can use the asset helper
asset('storage/myimage.jpg');
<img src="{{asset('storage/myimage.jpg')}}">
have you tried
<img src="{{ asset( $upload->filename ) }}" />
Please or to participate in this conversation.