getRealPath() returns false(Laravel 5.2 & 图像干预)
getRealPath() returns false (Laravel 5.2 & Image Intervention)
上传图片时,getRealPath()
总是returnsfalse
:
$image_file = $request->file('image_file');
$image_file->getRealPath(); // ---> FALSE
这是 dd($image_file);
的结果:
此外,当我尝试将它与图像干预一起使用时:
$image_file = $request->file('image_file');
Image::make($image_file->getRealPath())->.....
我收到以下错误:
NotReadableException in AbstractDecoder.php line 323: Image source not
readable
很明显是因为getRealPath()
returns false
...已经有人问过这个问题了:getRealPath returning false (Image Intervention and Laravel 5.1) ...但是没有解决方案
你知道为什么会这样吗?我该如何解决?
问题出在 php.ini - 上传目录不正确。
我遇到了与 getRealPath()
相同的问题。当我 dd()
时,它 returns 是假的。
请尝试使用 $request->getPathname()
。
上传图片时,getRealPath()
总是returnsfalse
:
$image_file = $request->file('image_file');
$image_file->getRealPath(); // ---> FALSE
这是 dd($image_file);
的结果:
此外,当我尝试将它与图像干预一起使用时:
$image_file = $request->file('image_file');
Image::make($image_file->getRealPath())->.....
我收到以下错误:
NotReadableException in AbstractDecoder.php line 323: Image source not readable
很明显是因为getRealPath()
returns false
...已经有人问过这个问题了:getRealPath returning false (Image Intervention and Laravel 5.1) ...但是没有解决方案
你知道为什么会这样吗?我该如何解决?
问题出在 php.ini - 上传目录不正确。
我遇到了与 getRealPath()
相同的问题。当我 dd()
时,它 returns 是假的。
请尝试使用 $request->getPathname()
。