InterventionImageExceptionNotWritableException: Can’t write image data to path image array

  laravel, php, postman

i have something wrong with invertation image, i build some array upload for image, and i got this error from postman, how i must fix it?,, thank you…, this my code`

 $image_array = $data->file('image');
    $array_len = count($image_array);

    for ($i = 0; $i < $array_len; $i++) {

        $image_ext = $image_array[$i]->getClientOriginalExtension();
        $new_image_name = rand(123456, 9999999) . "." . $image_ext;


        // $img = Image::make($image_array[$i]);

        $destination_path = public_path('/galeri');
        $img = Image::make($image_array[$i]);
        
        $img->resize(100, 100)->save($destination_path);
        $image_array[$i]->move($destination_path, $new_image_name);

        $baru = new ModelsImage();

        $baru->image = $new_image_name;
        $baru->product_id = $data->input('product_id');
        $baru->save();
    }

this my eror image

Source: Laravel

Leave a Reply