I got that error. I'm trying to resize an image for my photo gallery. folder should have the album_id, please help me to fix this.
Intervention \ Image \ Exception \ NotWritableException Can't write image data to path
Can't write image data to path (album_image/photos/16/1515270724.png)
Here's my code:
if($request->hasFile('photo')){
$photo = $request->file('photo');
$filenameToStore = time() . '.' . $photo->getClientOriginalExtension();
$location = $request->file('photo')->storeAs('album_image/photos/'.$request->input('album_id'), $filenameToStore);
Image::make($photo)->resize(500,500)->save($location);
}
Are you sure the directory exists? If so does it have the right permissions? That's usually the isue
an error
Can't write image data to path (/var/www/html/laravel_project/public/uploads/profileImage/1532779085.jpg)
Are you sure the directory exists? If so does it have the right permissions? That's usually the isue
I am also getting the same error. how do we have the right permission??
I would double check the path you are trying to save to and ensure it exists.
This most often happens if the folder doesn't exist, so you'll need to check and ensure it exists in your code before saving.
If it does exist then perhaps check permissions on the folder, this depends on your operating system etc so best to Google that.
@chris-faulkner you are perfectly right because it throws an error if the folder doesn't exist.
I think it's worth asking why the library doesn't auto-create the folder?
Most helpful comment
I would double check the path you are trying to save to and ensure it exists.
This most often happens if the folder doesn't exist, so you'll need to check and ensure it exists in your code before saving.
If it does exist then perhaps check permissions on the folder, this depends on your operating system etc so best to Google that.