Image source not readable in Laravel 5.2 - Intervention Image

前端 未结 6 743
攒了一身酷
攒了一身酷 2021-02-07 18:20

I have a small problem concerning the resizing process of a given image, I am trying to submit a form containing an input type -->file<-- I was able to upload a picture witho

6条回答
  •  名媛妹妹
    2021-02-07 18:43

    This problem occurred when you resize the image after moving it

    $file->move('uploads', $fileName);

    $file->getRealPath() will return false after moving the image. You need to resize the image before the moving process. That's it ;)

    $img=Image::make('public/uploads/', $file->getRealPath())->resize(320, 240)->save('public/uploads/',$file->getClientOriginalName());
    $file->move('uploads', $fileName);
    

提交回复
热议问题