Last updated on March 19, 2024 pm
优点介绍
免费额度 足够个人使用
无需额外配置 CDN
自定义域名比较优雅
Free
Paid - Rates
存储
10 GB / month
$0.015 / GB-month
A 类操作
1 million requests / month
$4.50 / million requests
B 类操作
10 million requests / month
$0.36 / million requests
第一步 创建 R2 存储桶
第二步 绑定域名
第三步 创建 S3 令牌
第四步 安装 lsky 图床
1 2 mkdir -p ~/app/Lsky && cd ~/app/Lsky && nano docker-compose.yml docker-compose up -d
1 2 3 4 5 6 7 8 9 10 11 12 version: '3.3' services: lsky-pro: restart: always volumes: - './lsky-pro-data:/var/www/html' image: 'dko0/lsky-pro' networks: default: external: true name: ngpm
第五步 图床添加 R2 储存桶
附加 图床备份
1 2 sudo -v ; curl https://rclone.org/install.sh | sudo bash -s beta nano ~/.config/rclone/rclone.conf
1 2 3 4 5 6 7 [img] type = s3provider = Cloudflareaccess_key_id = xxxsecret_access_key = xxxxxxendpoint = https://<accountid>.r2.cloudflarestorage.comacl = private
1 2 3 4 5 rclone lsd img:limour-img git clone https://oauth2:ghp_xxx@github.com/limour-blog/img-bed.git rclone copy --ignore-existing --progress --ignore-errors img:limour-img ~/img-bedcd ~/img-bed git add . && git commit -m 'backup' && git push -u origin main
附加 图片预处理
1 2 3 4 5 6 D:\ImageMagick-7 .1.1 -Q16 \magick.exe convert -resize 512 x512^ -gravity North -extent 512 x512 -quality 50 -define WebP:lossless=false F:\temp\randImg\*.jpg 26 .webp
附加 旧图片归档
1 2 3 4 5 6 7 8 9 10 mkdir ~/img-bed apt install imagemagick convert -version find ~/app/Lsky/lsky-pro-data/storage/app/uploads -type f -name "*.png" -exec sh -c 'mkdir -p ~/img-bed/$(dirname {}); convert {} -quality 30 -define webp:lossless=false ~/img-bed/$(dirname {})/$(basename {} .png).webp' \; find ~/app/Lsky/lsky-pro-data/storage/app/uploads -type f ! -name "*.png" -exec sh -c 'mkdir -p ~/img-bed/$(dirname {}); cp {} ~/img-bed/$(dirname {})/$(basename {})' \;mv ~/img-bed/root/app/Lsky/lsky-pro-data/storage/app/* ~/img-bed & rm -rf ~/img-bed/root & mv ~/img-bed/uploads ~/img-bed/archives_2023
1 2 rclone lsd img:limour-img rclone copy --ignore-existing --progress --ignore-errors ~/img-bed img:limour-img
1 2 3 sed -i 's|https://img-cdn.limour.top/i/|https://img.limour.top/archives_2023/|g' *.md sed -i 's|https://img-cdn.limour.top/|https://img.limour.top/archives_2023/|g' *.md sed -i 's#https://img.limour.top/archives_2023/\(.*\)\.png#https://img.limour.top/archives_2023/\1.webp#g' *.md
【白嫖】使用 CloudFlare R2 搭建个人图床
https://hexo.limour.top/-bai-piao--shi-yong-CloudFlare-R2-da-jian-ge-ren-tu-chuang