nanadjei2's avatar

Intervention Image

am trying to upload an image using Intervention Image but i got this error. Can't write image data to path (http://localhost/ecomm/public/img/products/2016-01-07-19:08:55-tablet-upload.jpg)

This is my controller; $image = Input::file('image'); $filename = date('Y-m-d-H:i:s')."-".$image->getClientOriginalName(); Image::make($image->getRealPath())->resize('468, 249')->save(asset('/img/products/'.$filename)); $product->image = asset('img/products'.$filename);

0 likes
1 reply
nanadjei2's avatar
nanadjei2
OP
Best Answer
Level 4

it should rather be this. $image = Input::file('image'); $filename = time().'-'.$image->getClientOriginalName(); $path = public_path('/img/products/'.$filename); Image::make($image->getRealPath())->resize(468, 249)->save($path); $product->image = asset('img/products'.$filename);

Please or to participate in this conversation.