getRealPath()返回false(Laravel 5.2&Image Intervention) [英] getRealPath() returns false (Laravel 5.2 & Image Intervention)

查看:363
本文介绍了getRealPath()返回false(Laravel 5.2&Image Intervention)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

上传图像时,getRealPath()始终返回false:

When uploading images, getRealPath() always returns false:

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

这是dd($image_file);的结果:

此外,当我尝试将其与Image Intervention一起使用时:

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

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

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

我遇到以下错误:

AbstractDecoder.php第323行中的NotReadableException:图像源不正确 可读

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

显然是因为getRealPath()返回false ...有人已经问过这个问题:

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.

您知道为什么会这样吗,我该如何解决?

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

推荐答案

问题出在 php.ini 中-上传目录不正确.

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

这篇关于getRealPath()返回false(Laravel 5.2&Image Intervention)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆