Laravel 5 无法使用laravel和intervation图像在公共html/图像中写入

Laravel 5 无法使用laravel和intervation图像在公共html/图像中写入,laravel-5,dropzone.js,Laravel 5,Dropzone.js,我的权限有问题。在我的主机上,我在/home/public_html/images上创建了一个文件夹images,并从cpanel 777设置了完全权限。当我尝试使用dropzone上传图像时,它会显示: production.ERROR: exception 'Intervention\Image\Exception\NotWritableException' with message 'Can't write image data to path (/home/username/app_fo

我的权限有问题。在我的主机上,我在/home/public_html/images上创建了一个文件夹images,并从cpanel 777设置了完全权限。当我尝试使用dropzone上传图像时,它会显示:

production.ERROR: exception 'Intervention\Image\Exception\NotWritableException' with message 'Can't write image data to path (/home/username/app_folder/public/images/15003681530.jpg)' in /home/username/app_folder/vendor/intervention/image/src/Intervention/Image/Image.php:143
为什么试图写入/home/username/public/images文件夹?文件夹不在该路径中,位于/home/username/public\u html/images中

// create a unique name for each image
$filename = time() . $i . '.' . $image->getClientOriginalExtension();
// create a location
$location = public_path('images/').$filename;
// save the image to that location
Image::make($image->getRealPath())->resize(200,200)->save($location);
我正在为laravel使用laravel 5.4和干预图像。

我发现了这种方法:

$location = base_path().DIRECTORY_SEPARATOR.'..'.DIRECTORY_SEPARATOR.'public_html/images/'.$filename;

每次上传我的项目时,我都必须改变这个。在localhost上,公用文件夹位于项目中,在我的域上上载项目时,我会按项目分隔公用文件夹。如果我用“/home/username/public\u html/images”设置$location而不是public\u path('images'),则公用文件夹的内容位于public\u html文件夹上,项目本身位于根主文件夹上。使用什么函数获取公用文件夹位置???