PicUploader icon indicating copy to clipboard operation
PicUploader copied to clipboard

使用dashboard.php和图床软件上传图片无法正常返回链接

Open qyhfrank opened this issue 3 years ago • 8 comments

在服务器上部署PicUploader,发现默认的sm.ms图床可以正常通过dashboard,picgo或upic上传并返回链接,而s3和minio(其他还没尝试)无法返回链接。具体表现是:

  • dashboard上传:卡在上传中...,但是可以在后台查看到图片已经上传
  • picgo上传:返回{},但是可以在后台查看到图片已经上传
  • upic: response could not be serialized, input data was nil or zero length

记得以前部署的时候没有问题,这次的问题是基于全新部署,希望可以帮忙看一下问题是出在哪里,谢谢啦🙏 此外,文件夹中即使上传了图片貌似也没有出现logs目录?

qyhfrank avatar Oct 21 '20 13:10 qyhfrank

没有logs目录可能是php没有权限创建目录,你检查一下权限。至于无法上传问题,你直接用命令试试能不能上传,能上传了再来查dashboard的问题,不能就看报什么错

php /path/to/PicUploader/index.php /path/to/test.jpg

另外dashboard里试试把“压缩到原图的”设置为100%,然后把添加水印关掉,然后在dashboard传试试,如果可以,那就是你的php安装的有问题。

xiebruce avatar Oct 22 '20 08:10 xiebruce

尝试了直接用命令,可以上传,输出markdown格式的链接。把压缩和水印调整后还是无法正常上传。控制台在dashboard.js的103行有如下warning

<br />
<b>Warning</b>:  is_readable(): open_basedir restriction in effect. File(/home/www/.aws/config) is not within the allowed path(s): (/www/wwwroot/PicUploader/:/tmp/) in <b>/www/wwwroot/PicUploader/vendor/aws/aws-sdk-php/src/ClientSideMonitoring/ConfigurationProvider.php</b> on line <b>236</b><br />
{"code":"success","data":{"filename":"image.png","url":"![image.png](https:\/\/xxxx.com\/img\/ab2dc5e5ccc0d01a1127fd3faf2c5097.png)","notFormatUrl":"https:\/\/xxxx.com\/img\/ab2dc5e5ccc0d01a1127fd3faf2c5097.png"}}

qyhfrank avatar Oct 22 '20 08:10 qyhfrank

应该是权限问题,你的php和nginx的运行用户和组分别是什么?PicUploader的用户和组又是什么?

xiebruce avatar Oct 22 '20 08:10 xiebruce

image

/www/server/php/73/etc/php-fpm.d/www.confimage

/www/server/nginx/conf/nginx.confimage

qyhfrank avatar Oct 22 '20 09:10 qyhfrank

看上去没问题呀,你这个报错是往哪个云传的?

<br />
<b>Warning</b>:  is_readable(): open_basedir restriction in effect. File(/home/www/.aws/config) is not within the allowed path(s): (/www/wwwroot/PicUploader/:/tmp/) in <b>/www/wwwroot/PicUploader/vendor/aws/aws-sdk-php/src/ClientSideMonitoring/ConfigurationProvider.php</b> on line <b>236</b><br />
{"code":"success","data":{"filename":"image.png","url":"![image.png](https:\/\/xxxx.com\/img\/ab2dc5e5ccc0d01a1127fd3faf2c5097.png)","notFormatUrl":"https:\/\/xxxx.com\/img\/ab2dc5e5ccc0d01a1127fd3faf2c5097.png"}}

xiebruce avatar Oct 22 '20 09:10 xiebruce

往s3和minio,都是s3 compatible的,其他的我还没试,要是有必要我可以尝试下腾讯云

qyhfrank avatar Oct 22 '20 09:10 qyhfrank

我比较在意那个is_readable的报错,我服务器上也没在那个路径放aws的密匙,上传也只需要我提供在picuploader的密匙就够了吧?

报错看上去连response也准备好了,是什么原因导致无法返回吗?

qyhfrank avatar Oct 22 '20 09:10 qyhfrank

不是无法返回,是报错信息混杂在response里,就导致response不是一个json串,不是json当然就无法正常解析出来了,我查查是什么原因吧

xiebruce avatar Oct 22 '20 09:10 xiebruce