1 Star 0 Fork 0

星冉/Typora-image-upload

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
win-upload.sh 1.13 KB
一键复制 编辑 原始数据 按行查看 历史
星冉 提交于 2020-07-17 18:04 . Initial commit
#!/bin/bash
remote_path="temp/" # 上传默认的路径(Upload default path)
base_url="https://cdn.jsdelivr.net/gh/User/cdn@master/img/" # 自定义域名(Custom domain name)
push_path="D:\Github\cdn\img\\" # 末尾必须双斜杠(Must end with a double slash)
# 计算上传图片数量(Calculate the number of uploaded files)
for i in "$@"; do
IFS='/' read -r -a array <<< "$i"
id="${#array[@]}"
done
for l in "$@"; do
# 开始填充URL(Start filling URL)
current=`date "+%Y-%m-%d %H:%M:%S"`
timeStamp=`date -d "$current" +%s`
#将current转换为时间戳,精确到毫秒(Converted to a timestamp, accurate to milliseconds)
currentTimeStamp=$((timeStamp*1000+`date "+%N"`/1000000))
# 获取后缀名(Get suffix)
new_name=$currentTimeStamp.${i##*.}
push_paths=$push_path$remote_path$currentTimeStamp.${i##*.}
url="$base_url""$remote_path""$new_name"
# 复制输出文件到指定地址(Copy the output file to the specified address)
cp $i $push_paths
# 复制链接到粘贴板(Copy link to pasteboard)
echo "![image-"$currentTimeStamp"](""$url"")" | clip
# TODO linux可以在这修改(Linux can be modified here)
done
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
Shell
1
https://gitee.com/XRSec/Typora-image-upload.git
[email protected]:XRSec/Typora-image-upload.git
XRSec
Typora-image-upload
Typora-image-upload
master

搜索帮助