Laravel 实战开发知乎: 头像上传到七牛
打赏作者

hard88

群主,优惠券在充值的时候怎么用?

JellyBool 回复 hard88

啥优惠券?七牛的么?你直接问客服啊…

hard88 回复 JellyBool

不是,是你的签到兑换会员的优惠。。今天到期了

JellyBool 回复 hard88

你加群跟我说呗

sean1 回复 JellyBool

卧槽,都是骗人的,什么都要钱

carsonlius 回复 sean1

有价值的东西 为什么不能换钱呢?

canihelpyou

后面还有更新吗?

LuoDestiny 回复 canihelpyou

当然会有啦。。。

JellyBool 回复 canihelpyou

嗯哼,是的会有

chenze007

刚刚用的这个插件 还以为 不好用
$disk->put(‘avatars/1’, fileContents); 如果这样 七牛上存的名字不是 avatars/1 是加密过的很长一串 我想难道还得回调 么 正要试试的时候想起了jelly 看完视频一顿调试问题出在↓ disk->put(filename,fopen(filename, fopen(fileContents->getRealPath(), ‘r’));
fopen(fileContents->getRealPath(), 'r')这里需要这样写不能把file
直接丢进去 虽然能上传但是 名字不能控制了

JellyBool 回复 chenze007

哈哈哈,及时雨

Augus

我遇到一个问题
配置好七牛,点击保存,图片能正确传到七牛空间,并且正确返回图片地址。
当vue中执行到 this.toggleShow()方法时, 隐藏裁剪对话框后,新上传的头像显示不出来,点击审查元素时,发现该引用的图片地址已经是七牛空间的地址了。 得再次刷新一下页面才能展示出来。。

b4e962c7-364b-47cd-b5af-b2bd7984a20c

JellyBool 回复 Augus

这个显示不出来的时候,console 是什么错?

Augus 回复 JellyBool

额,还真有错。932da9df17b75fd36c83fd56ef4a1239.png:1 GET http://image.lopbox.com/avatars/932da9df17b75fd36c83fd56ef4a1239.png 403 (Forbidden)

但是多刷新两次就好了

JellyBool 回复 Augus

403 Forbidden…

这是你的空间设置问题吧,比如白名单或者是私有空间等,跟代码基本没什么关系

Augus 回复 JellyBool

en , 我也怀疑是这方面的问题, 猜测是否是防盗链,但检查了, 不是私有空间,并且没有设置防盗链

yaoye6262

根据您上面的代码,上传到七牛 返回 false ! 是怎么回事?

yaoye6262

fopen($file->getRealPath(), ‘r’) 这里也是返回false

JellyBool 回复 yaoye6262

不知道,没代码看不出来

Ming Zhou

我发现如果把空间设置为私有空间,上传图片成功后获取图片时,会返回 {error: "token not specified"},因为私有空间是需要授权才能下载对应的资源

JellyBool 回复 Ming Zhou

私有空间的话,你需要参考七牛的文档,返回 url 的时候携带认证的 token

WannaProGrammer 回复 JellyBool

站长,我的七牛云上传总是报这个错。Provisional headers are shown。百度的答案没怎么看懂,求指教。

JellyBool 回复 WannaProGrammer

不清楚啊,没遇到过这个错误。很久不用七牛了

WannaProGrammer 回复 JellyBool

恩 我再研究下

RoseEnd

上传头像之后提示token错误,能上传成功,但是上传的modal框一直停留在正在上传…不会自动关闭了,这个怎么解决?

Uncaught SyntaxError: Unexpected token r in JSON at position 1
    at JSON.parse (<anonymous>)
    at XMLHttpRequest.client.onreadystatechange (eval at <anonymous> (app-83e06ee75d.js:927), <anonymous>:744:38)
JellyBool 回复 RoseEnd

Unexpected token r in JSON

感觉是你的 json 格式没对

liujun

七牛的认证真的是繁琐冗余 认证还要等三天

carsonlius 回复 liujun

+1 ;等待中

carsonlius

教主 这个教程真是我想要的

JellyBool 回复 carsonlius

感谢大佬支持

Flourishing

感谢安正超和JellyBool大神_

JellyBool 回复 Flourishing

确实,超哥还是很厉害的