美文网首页
PicGo + Gitee 做自己的图床

PicGo + Gitee 做自己的图床

作者: _孙行者_ | 来源:发表于2022-01-21 15:02 被阅读0次

npm 修改ali源:

npm config set registry https://registry.npm.taobao.org
# 查看
npm config get registry

PicGo 官网: https://picgo.github.io/PicGo-Core-Doc/

image

安装:

Global install

npm install picgo -g

# or

yarn global add picgo

Local install

npm install picgo -D

# or

yarn add picgo -D

插件列表:
https://github.com/PicGo/Awesome-PicGo

搜索并安装插件 , 我这里安装了 gitee和 compress


image

gitee 插件

Config
  • repo: repo name, split by '/', eg: owner/repoName
  • branch: default master
  • token: gitee personal access token
  • path: file path
  • customPath: auto config path
  • customUrl: used to insead of https://gitee.com/:owner/:repo/raw/:path/:filename, eg: ${customUrl}/path/filename.jpg

makesure the customUrl can access your repo

customPath

自动配置path路径 示例:path:blog/$customPath

  1. customPath选择年,则实际的path值为blog/2019
  2. customPath选择年季,则实际的path值为blog/2019/summer
  3. customPath选择年月,则实际的path值为blog/2019/01

$customPath为占位符。

compress 插件

  • 安装 picgo add compress

  • 选择使用 picgo use transformer

  • 参数配置 picgo config plugin compress

    compress 选择压缩工具 默认选项

    • imagemin +luban 算法,最大程度节省流量,默认选项
    • imagemin 压缩过程不需要经过网络,但是图片会有损耗
    • imagemin_webp 本地有损压缩,支持GIF格式有损压缩 注意:有些图床(比如sm.ms)不支持webp图片格式,会上传失败
    • tinypng 无损压缩,需要上传到 tinypng
    • lubanforgitee 将所有图片压缩到1M以下,解决gitee的1M外链不能访问的问题.

nameType 是否重命名

  • timestamp 重命名成时间戳
  • none 不重名,默认选项

key 可选

  • developers 中申请
  • 逗号,隔开,可使用多个 Key 叠加使用次数

界面上启用 , 启用后 , 压缩功能才会启用:


image.png

相关文章

网友评论

      本文标题:PicGo + Gitee 做自己的图床

      本文链接:https://www.haomeiwen.com/subject/tqvehrtx.html