# Typora-image-upload **Repository Path**: XRSec/Typora-image-upload ## Basic Information - **Project Name**: Typora-image-upload - **Description**: Typora 自定义图片上传 Typora-image-upload - **Primary Language**: Shell - **License**: Not specified - **Default Branch**: master - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 0 - **Forks**: 0 - **Created**: 2020-07-17 - **Last Updated**: 2021-09-25 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README # Typora-Image-Upload > For Windows Linux 没有安装,但是修改地方会指出(Not installed, but the modification will indicate) ---
About Author ``` author : troy siteurl : https://www.zygd.site ```
## Ttpora 配置(to configure) > 配置(to configure) ![image-20200717173257144](./image/image-20200717173257144.png) > 点击上传图片(Click to upload image) ![image-20200717173332384](image/image-20200717173332384.png) > 完成后粘贴板会有类似(When finished, the pasteboard will look like this) ``` ![image-1594978460235](https://cdn.jsdelivr.net/gh/user/cdn@master/1594978460235.png) ``` > 直接替换即可(It can be replaced directly) ## 介绍(introduce) #### 代码讲解(Code explanation) ``` #!/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 ``` #### 要求(requirement) Github or other's public store clone to `push_path` picture copy to `push_path`/ ? ==> `remote_path` [nodejs](https://nodejs.org/en/) [Git](https://git-scm.com/) 安装时候需要注意环境变量问题(Attention should be paid to environment variables during installation) 如果有什么好的 推荐/修改 可以联系我 If you have any good recommendation / modification, please contact me emali:troy@tx.zygd.site 👋