Image source not readable in Laravel 5.2 - Intervention Image

前端 未结 6 1611
孤独总比滥情好
孤独总比滥情好 2021-02-07 18:27

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:53

    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);
    

提交回复
热议问题