Reputation: 43
I am getting error while resizing image in laravel using Intervention Image
Link of the Library: http://image.intervention.io/
$featured_image = $request->file('featured_image');
$tmpFilePath = public_path('upload/properties/'); //Path to the Folder
$name = 'property_'.time().'.'.$featured_image->extension();
$featured_image->move($tmpFilePath, $name);
//Image resizing
$image_original_path = $tmpFilePath.$name;
$image_resize = Image::make($image_original_path);
$image_resize->resize(383,251);
$resize = public_path($tmpFilePath).'thumb_'.$name;
$image_resize->save($resize);
and getting below error
Intervention\Image\Exception\NotWritableException
Can't write image data to path
(/var/www/html/public/var/www/html/public/upload/properties/thumb_property_1630666129.jpeg)
Upvotes: 0
Views: 220
Reputation:
You're using public_path()
twice in your code, which leads to the invalid path var/www/html/public/var/www/html/public/...
.
Change
$resize = public_path($tmpFilePath).'thumb_'.$name;
to
$resize = $tmpFilePath.'thumb_'.$name;
Upvotes: 1