【发布时间】:2017-11-03 15:17:59
【问题描述】:
我需要在我的视图中显示存储的图像。我使用下面的代码将图像存储在数据库中,
$file = Input::file('pic');
$img = Image::make($file);
Response::make($img->encode('jpeg'));
$picture = new Car;
$picture->cartype = Input::get('cartype');
$picture->price = Input::get('price');
$FileName = Input::file('pic')->getClientOriginalName();
$FilePath = public_path('') .'/images/'. $FileName;
$picture->name = $FilePath;
$picture->save();
在我的控制器中(检索图像)
public function index()
{
$cars = DB::table('car_category')->get();
return view('category.category',['cars'=>$cars]);
}
我应该如何检索和显示视图中的图像?
【问题讨论】: