Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/linyimin0812/upload-image-to-oss
Auto upload image to oss when copy image, and return the link of image
https://github.com/linyimin0812/upload-image-to-oss
clipboard oss typescirpt xclip
Last synced: 9 days ago
JSON representation
Auto upload image to oss when copy image, and return the link of image
- Host: GitHub
- URL: https://github.com/linyimin0812/upload-image-to-oss
- Owner: linyimin0812
- License: mit
- Created: 2018-08-17T05:32:53.000Z (over 6 years ago)
- Default Branch: master
- Last Pushed: 2019-11-18T08:28:53.000Z (about 5 years ago)
- Last Synced: 2024-12-11T01:44:53.192Z (23 days ago)
- Topics: clipboard, oss, typescirpt, xclip
- Language: TypeScript
- Size: 55.7 KB
- Stars: 2
- Watchers: 2
- Forks: 0
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
A tool to upload picture(copy or cut) which stored in clipboad to OSS, and return a url link, we can use this url to visit the picture, which may be convenient when add a picture in markdown.
### usage
- Copy the follow content to .env in project's root directory, and specify the server information
```
# Server Mode: We support "OSS" and "Apache Server" Now
## You can specify "OSS" or "Apache"
mode=OSS# Aliyun Object Storage Service (OSS)
## bucket 所在的区域, 默认 oss-cn-hangzhou
region=******
## 通过阿里云控制台创建的access key。
accessKeyId=******
## 通过阿里云控制台创建的access secret
accessKeySecret=******
## 通过控制台创建的bucket, 或通过putBucket创建
bucket=******# Apache Sever
## Server IP, 默认是localhost
serverIP=localhost
## Server的ssh端口, 默认是22
sshPort=22
## Server 的账户
account=******
## 账户对应的密码
password=******
## 图片所处的目录, 默认是/var/www/html/images
imagesDirectory=/var/www/html/images
## 访问图片的url, 设置之后可以访问到所有图片,并可以修改图片名称
imagesUrl=/images
## Apache Server 对应的端口, 默认是80
serverPort=80
```---
This plugin support OSS and Apache Server, specify the infomation of server which you choose to store the pictures.
If you choose **mode equal to OSS**, then the Picture will upload to the OSS
else **mode equal to Apache**, and the Picture will upload to the Apache Server---
- Install xclip package
```shell
$ sudo apt-get install xclip
```If want to upload the pictures to apache server, you should install sshpass plugin.
```shell
$ sudo apt-get install sshpass
```More detail information about [xclip](https://github.com/astrand/xclip)
More detail information about [sshpass](https://gist.github.com/arunoda/7790979)
- Install upload-image-to-oss
```shell
$ npm i upload-image-to-oss
```---
- Specify shortcut to upload picture when copy a cut a picture
```typescript
import start from 'upload-image-to-oss'start(['ctrl', 'alt', 'u'])
```---
When the type of content stored in clipboard is picture, and if you press `ctrl+alt+u`,the picture will be uploaded to the specified OSS, and the link will store in clipboard, so you can use `ctrl+v` to get the link.
### CHANGELOG
---
**v1.0.7**(20 Aug 2018)
1. Specify shortcut to upload image which stored in clipboard.
2. Give a Pop-up notification after uploaded the picture(copy or cut) stored in clipboard to OSS
3. Log in ~/.upload-image-to-oss**v1.0.8**(22 Aug 2018)
1. Support Upload picture to Apache Server**v1.0.9**(09 Sep 2018)
1. Fixed any three will trigger when specify a three key shortcut bug.**v1.0.10**(13 Sep 2018)
1. Repalce wiston with brolog