问题
七牛云的测试连接失效,hexo博客上的图片都不能显示
1.下载七牛云中保存的图片
参照官网 命令行辅助工具(qrsctl)
-
命令行登录到七牛云
-
执行代码:
准备下载2018summerfight这个存储空间的文件,一共242个
python LoadImage.py执行代码,选择2018summerfight
代码部分
# -*- coding: utf-8 -*-
# @Author: Viking
# @Date: 2018-12-01 14:01:14
# @Last Modified by: Viking
# @Last Modified time: 2018-12-01 17:30:12
# download imgage from qi-niu-yun
'''
command
qrsctl-v3.2.20170501 buckets
- list all buckets
qrsctl-v3.2.20170501 listprefix bucket prefix
- list all files
qrsctl-v3.2.20170501 get bucket key destfile
- dowdload file
'''
import os
# list all your buckets
print("存储空间列表(buckets): ")
os.system('qrsctl-v3.2.20170501 buckets')
print('\n\n')
bucket = input("input your bucket: ")
# install images information of bucket
cmd = 'qrsctl-v3.2.20170501 listprefix {} "" > out_file.txt'.format(bucket)
os.system(cmd)
# remove first line 'marker: '
with open('out_file.txt','r',encoding='utf-8') as fin:
data = fin.read().splitlines(True)
with open('out_file.txt','w',encoding='utf-8') as fout:
fout.writelines(data[1:])
# mkdir folder of bucket to store images
os.mkdir('./{}'.format(bucket))
# dowdload images cmd
cmd_dowdload='qrsctl-v3.2.20170501 get {0} {1} ./{0}/{1}'
with open('out_file.txt','r',encoding='utf-8') as f:
# remove \n
image = f.readline().strip()
number=1
while image:
# load file
tmp=cmd_dowdload.format(bucket,image)
print("the {} image dowdloading...".format(number))
os.system(tmp)
# next image
image = f.readline().strip()
number = number + 1
- 下载完成
存储到本机上的图片
2. Gitee(码云)、Github同时配置ssh key
- 是的,准备将这些图片暂时迁移到上Gitee(码云)、Github同时配置ssh key(毕竟那是一个存放代码的圣地,必须保持敬畏之心)
-
上传到gitee的图片信息(git的部分我就不详细写了... ...我相信大家都会)
图片的外部链接需要更改:
将blob替换为raw
https://gitee.com/q10viking/blog_image/blob/master/2018summerfight/Disjoint-set-2.png
变成
https://gitee.com/q10viking/blog_image/raw/master/2018summerfight/Disjoint-set-2.png
3 .迁移到gitee的图片展示。(该图片来自gittee)
参考如何使用gitee作为免费图床