laravel - 无法在服务器上将 public_path 设置为 public_html
问题描述
我想在图像上添加一些文本......我已经有一个图像并在其上添加文本......所以现在我正在使用图像干预包。它在我的本地机器上工作正常,但在服务器上它显示一些图像源也没有可读错误....我在上传此代码时看到...图像文本在公共文件夹中工作正常,但我想在 public_html/images 上添加图像而不是 public/images 因为主要图像文件夹位于 public_html 中,所以我可能必须将默认公共路径 public 更改为 public_html。
图像制作功能
{
$img = Image::make(public_path('/home/u944619310/domains/shubhampackers.com/public_html/images/Capture.JPG'));
$img->text('This is a example ', 300, 300);
$img->save(public_path('/home/u944619310/domains/shubhampackers.com/public_html/images/vivk.jpg'));
return response()->json(['success'=>true]);
}
error showing
message: "Image source not readable", exception: "Intervention\Image\Exception\NotReadableException",…}
exception: "Intervention\Image\Exception\NotReadableException"
file: "/home/u944619310/domains/shubhampackers.com/public_html/vendor/intervention/image/src/Intervention/Image/AbstractDecoder.php"
line: 346
message: "Image source not readable"
even i tried given method from stack overflow to do some changes in App/Providers/AppServiceProvider.php
public function register()
{
//
$this->app->bind('path.public', function() {
return base_path().'/public_html';
});
}
解决方案
推荐阅读
- javascript - 如何通过网页抓取填写表单?
- vb.net - 有没有办法在 LINQ 查询本身中为组加入设置默认值(0 而不是 null)?
- lua - 如何在 lua 中修复此代码以在 scrapy 启动项目中启动?
- reactjs - Axios Post Method 没有激活BackEnd中的Action
- c# - 如何识别操作系统中可用的 Windows 凭据管理器
- flutter - Flutter中的Webview无法正常工作,出现平台错误
- javascript - 如何在 JavaScript 中转换文档数组中的字典?
- javascript - 带计时器的用户会话超时
- iphone - Firebase CloudMessage
- python - 跨数据框'Pandas'中的行查询