- 注册七牛云账户
- 创建属于你的账号并完善相关信息,在个人中心获取
AccessKey/SecretKey
。- 添加对象存储空间
bucket
,对于没有绑定过自己域名(需要备案)的账号,七牛云会提供一个测试域名,后续图片访问也是基于该域名的。
- 配置
conf.json
{
"src": "Local directory to upload",
"dest": "qiniu:access_key=[Please apply your access key here]&secret_key=[Dont send your secret key to anyone]&bucket=[Bucket name on qiniu resource storage]",
"debug_level": 1
}
- 使用命令同步文件
在命令行运行qrsync conf.json
即可提交文件。
_> qrsync conf.json
2017/05/12 14:15:02.185127 [INFO] qbox.us/qrsync/v3/qrsync/qrsync.go:50: Syncing E:\blogImg => jq-blog
2017/05/12 14:15:02.218215 [INFO] qbox.us/qrsync/v3/sync/sync.go:172: Putting others/qiniuLogo.png
2017/05/12 14:15:02.623598 [INFO] qbox.us/qrsync/v3/sync/sync.go:146: Put E:\blogImg/others/qiniuLogo.png => jq-blog:others/qiniuLogo.png
Sync done!
成功上传!
图片地址为:
http://[域名][图片路径]
,如:
http://oe8r161mt.bkt.clouddn.com/others/qiniuLogo.png
- chrome插件
chrome 上安装qiniu upload files方便管理和查看。
如果需要不同大小的图片,可在图片URL后添加查询参数如:?imageView/2/w/400/q/100
来定义图片大小和质量。
详情参考七牛图片基本处理开发者中心文档。