abdulaziz-m5u / laravel-ecommerce

laravel ecommerce
53 stars 24 forks source link

Add image error in host #3

Open trunglemobiledev opened 1 year ago

trunglemobiledev commented 1 year ago

Intervention\Image\Exception\NotWritableException Can't write image data to path

andikatuluspangestu commented 1 year ago

Pastikan folder images memiliki izin tulis. Anda dapat memastikan bahwa folder memiliki izin tulis dengan menjalankan perintah ls -ld namafolder di terminal. Pastikan izin pada folder tersebut adalah drwxrwxrwx. Jika tidak, Anda dapat mengubah izin dengan menjalankan perintah sudo chmod 777 namafolder.

pxmmpd commented 11 months ago

Ok so here is how i solved it, I made the directory first before storing,

Storage::disk('local')->makeDirectory('blogpost/' . $postId); Once the folder is created i then go on to store the manipulated images like so:

$image->save(storage_path('app/blogpost/' . $postId . '/' . $imageName)); And then pushing the image to S3

$filesystem->put('blogpost/' . $postId . '/' . $imageName, file_get_contents(storage_path('app/blogpost/' . $postId . '/' . $imageName)));