Tôi đang cố gắng lưu một hình ảnh được điều khiển mà tôi sẽ đẩy chúng vào s3.Không thể lưu hình ảnh can thiệp hình ảnh. NotWritableException trong dòng Image.php 138
Mã của tôi mà làm việc Mã này lưu ảnh trực tiếp trong thư mục công cộng *
public function store(Filesystem $filesystem)
{
$request = Input::all();
$validator = Validator::make($request, [
'images' => 'image'
]);
if ($validator->fails()) {
return response()->json(['upload' => 'false']);
}
$postId = $request['id'];
$files = $request['file'];
$media = [];
$watermark = Image::make(public_path('img/watermark.png'));
foreach($files as $file) {
$image = Image::make($file->getRealPath());
$image->crop(730, 547);
$image->insert($watermark, 'center');
$image->save($file->getClientOriginalName());
}
}
gì tôi muốn đạt được là để có thể lưu nó trong một thư mục riêng của nó. Thứ nhất là nơi tốt nhất để lưu trữ hình ảnh cho một bài viết trên blog là gì, trong lưu trữ của công thư mục? Nhưng dù sao khi tôi làm điều này:
$image->save('blogpost/' . $postId . '/' . $file->getClientOriginalName());
// Or this
$image->save(storage_path('app/blogpost/' . $postId . '/' . $file->getClientOriginalName()));
tôi nhận được lỗi:
folder within public
NotWritableException in Image.php line 138: Can't write image data to path (blogpost/146/cars/image.jpg)
or
storage path
NotWritableException in Image.php line 138: Can't write image data to path /code/websites/blog/storage/app/blogpost/146/image.jpg
Tôi đã thử
cd storage/app/
chmod -R 755 blogpost
Và nó vẫn sẽ không làm việc
Cảm ơn bạn đã đọc này
Bạn có nghĩ điều này thực sự cần không? – ihue