getRealPath()返回false (Laravel 5.2 & Image Intervention)

时间:2022-10-18 20:11:33

When uploading images, getRealPath() always returns false:

上传图片时,getRealPath()总是返回false:

$image_file = $request->file('image_file');
$image_file->getRealPath(); // ---> FALSE

Here is the result of dd($image_file);:

这是dd($image_file)的结果;

getRealPath()返回false (Laravel 5.2 & Image Intervention)

Also, when I try to use it with Image Intervention:

同时,当我尝试使用它与图像干涉:

        $image_file = $request->file('image_file');

        Image::make($image_file->getRealPath())->.....

I am getting the following error:

我得到了以下错误:

NotReadableException in AbstractDecoder.php line 323: Image source not readable

NotReadableException AbstractDecoder。php第323行:图像源不可读

Obviously because getRealPath() returns false... Someone has already asked about this problem: getRealPath returning false (Image Intervention and Laravel 5.1) ... but there is no solution.

显然,因为getRealPath()返回false…有人已经问过这个问题:getRealPath返回false(图像干涉和Laravel 5.1)……但没有解决办法。

Do you know why is this happening, how can I fix this?

你知道为什么会发生这种事吗?

1 个解决方案

#1


0  

The problem was in php.ini - incorrect upload dir.

问题出在php中。不正确的上传目录。

#1


0  

The problem was in php.ini - incorrect upload dir.

问题出在php中。不正确的上传目录。