Layout:post
Title: Seven Cow Cloud bed storage +alfread Workflow + use Qshell
---
Seven Cow Cloud Atlas Bed Storage +alfread Workflow + use Qshell
The most vexing problem with markdown is the problem of texturing. There are a number of ways to upload pictures to the bed and get the outer chain aspect. The most convenient and natural way we want is to capture the image and then paste it into the markdown editor and upload it to the drawing bed automatically and complete the markdown image format. To put it simply, it's like pasting pictures into Word, and then the images are based on the outside chain and can be displayed anywhere on the Internet.
Preparatory work
It can be broadly divided into three parts:
1. Configuration of seven Qiniu
Configuration of 2.qshell
Configuration of 3.Alfread
1. Configuration of seven Qiniu 1.1 registration
If you do not have the seven Qiniu storage account, you can go to the official website to apply for an account. Provides 10G of free storage space, 10G per month of download traffic, 100,000 put/delete requests, 1 million get requests. Registration everyone will not say.
1.2 Creating new spaces and setting styles
In the style can create a new variety of styles to control the size of the picture, after all, markdown syntax does not control the size of the picture
1.3 Create a new key for Qshell access
Click Key Management in the personal panel
Create a new key, including Accesskey/secretkey, and configure Qshell to use the
Configuration of 2.qshell
Download Qshell to Https://developer.qiniu.com/kodo/tools/1302/qshell and rename to Qshell after downloading the Mac version
The new directory is used to place configuration files as well as data files as follows:
Modify the permissions of the Qshell file so that he becomes an executable file
chmod 755 /User/apple/Download/qshell
and place the Qshell file in the CLI directory and create the Conf.json configuration file in the CLI directory, as follows:
{ "src_dir":"/Users/think/QiNiu/Data/",##本地图片数据目录 "bucket":"markdownImage",##七牛云空间名称 "rescan_local":true, "check_exists":true, "check_hash":true, "check_size":true}
Configure the Qshell key, open the terminal in the CLI directory, use the command to set the key
qshell account [AccessKey] [SecretKey]
For example:qshell account kdajfiaifsanmflkwajfoiwr _fdaskrlakkkdasfanjjjj
- where [AccessKey] and [Secretkey] are the keys we generated above.
- When the configuration Qshell is complete, the ~/.qshell folder is generated, where the Account.json file holds AccessKey and secretkey information.
Configuration of 3.Alfread
To download the Alfred installation package and install it, you will need to purchase Powerpack to unlock the workflows function, or to collect the harmony version yourself.
Download Workflow: Baidu Cloud Disk Password: q18a
Modify the script after importing.
The script contents are as follows.
Property FileTypes: {? {? class PNGF?, ". png"},? {JPEG picture, ". jpg"}} On GetType () repeat with Atype in filetypes repeat with Theinfo in (Clipboard info) if (first item of Theinfo) is equal to (first item of Atype) then return Atype end Repeat end repeat return missing ValueEnd g Ettypeset Thetype to GetType () if Thetype isn't missing value then set FilePath to "/users/think/qiniu/data/"--Here you are Place the path of the picture set FileName to do shell script "date \" +%y%m%d%h%m%s\ "| MD5 "--use the MD5 value of the current time for the filename if filename does not end with (second item of thetype) then set filename to (filename & Secon D item of Thetype as text) set Markdownurl to "! [] (http://p7iq38s6i.bkt.clouddn.com/"& FileName &" -480p) "--here is your seven OX domain name and set the picture style set FilePath to FilePath & FileName try set ImageFile to (open for access FilePath with Write permission) set EOF ImageFile to 0 Write (the Clipboard as (first item of Thetype)) to ImageFile Close Access ImageFile Set the Clipboard to Markdownurl try tell application "System Events" Keystroke "V" using command down End-tell-end Try do shell script "/users/think/qi Niu/cli/qshell Qupload/users/think/qiniu/cli/conf.json "On Error try close access ImageFile End Try return "" End Tryelse Return "" End If
Need to modify the following places
set filePath to "/Users/think/QiNiu/Data/"
--Here's your own path to place the picture.
set markdownUrl to "![](http://p7iq38s6i.bkt.clouddn.com/" & fileName & "-480p)"
--Here is your seven Ox domain name and settings for the picture style, if no style is usedset markdownUrl to "![](http://p7iq38s6i.bkt.clouddn.com/" & fileName & ")"
do shell script "/Users/think/QiNiu/CLI/qshell qupload /Users/think/QiNiu/CLI/conf.json"
Persist after modification and add shortcut keys for the workflow. When pasting, use the shortcut key to paste
Seven Cow Cloud Atlas Bed Storage +alfread Workflow + use Qshell