picgo / picgo-core Goto Github PK
View Code? Open in Web Editor NEW:zap:A tool for pictures uploading. Both CLI & API supports.
Home Page: https://picgo.github.io/PicGo-Core-Doc/
License: MIT License
:zap:A tool for pictures uploading. Both CLI & API supports.
Home Page: https://picgo.github.io/PicGo-Core-Doc/
License: MIT License
阿里云OSS上传图片出错,但是不是一直出现,而是偶尔会出现(所以应该不是阿里云配置出现问题),异常信息是403 SignatureCanNotMatch,好像是因为生成signature的代码有问题,可以检查一下吗?
相册功能可以看到最近上传的图片,但是每次好像都是读取图片外链再显示。对于OOS,COS这种就比较不友好,流量费用问题是小事(不过如果相册里面条目很多,每次都请求一遍的话就不是小事了),尤其在开启防盗链相关选项后,本地电脑没办法绑定域名加入白名单,就会无法读取。而使用相册功能大多数情况下我觉得只是查找最近几次上传的照片而已 ,建议在本地缓存一下低分辨率的缩略图,大概区分每张图的内容就,找回生成的链接就可以了。
我有一个使用场景,公司内几个人用typora写文档,共用一个图床,但不想公开ak、sk。
我想如果PicGo-Server的api能支持post 图片内容,这样就可以把picGo部署到服务器上。写个脚本,把剪贴板图片post到PicGo-Server,这样就可以实现共用图床的功能
如果写中文的话变量识别不到
const config = ctx => {
let userConfig = ctx.getConfig('picBed.web-uploader')
if (!userConfig) {
userConfig = {}
}
return [
{
name: 'url',
type: 'input',
default: userConfig.url,
required: true
}
]
}
sample codes:
const picGo = new PicGo()
const result = await picGo.upload([image]) // image is `/Users/ransixi/Downloads/pap.er/x9iToq_5I4k.jpg`
Error:
TypeError: console.Console is not a constructor
at Logger.handleWriteLog (/Users/ransixi/Documents/marktext/node_modules/picgo/dist/lib/Logger.js:44)
at /Users/ransixi/Documents/marktext/node_modules/picgo/dist/lib/Logger.js:29
at processTicksAndRejections (internal/process/task_queues.js:79)
Line 45 in 8861984
现在好像只能支持固定的,希望可以自定义路径和文件名变量。
比如定义 %{YYYY}/${MM}/${DD}/
会出现类似于 2020/09/09/image-2020090919248657.png
这种结果,像一些常见的时间单位都可以增加支持。
同时可以增加一个 filename
配置项,支持变量控制文件名,比如 img-${unixtime}
结合上面的会得到 2020/09/09/img-1599595866576.png
之类的结果。
v.1.4.16 编译出错,是否是部分 PicGo 符号没有改为 IPicGo 接口?
node_modules/picgo/dist/src/types/index.d.ts:200:18 - error TS2304: Cannot find name 'PicGo'.
200 handle: ((ctx: PicGo) => Promise<any>) | ((ctx: PicGo) => void)
~~~~~
node_modules/picgo/dist/src/types/index.d.ts:200:51 - error TS2304: Cannot find name 'PicGo'.
200 handle: ((ctx: PicGo) => Promise<any>) | ((ctx: PicGo) => void)
我想要把圖片上傳到帳號內的特定相簿之中
如果我在config.json中新增"album": "albumId"
這樣是可以支援的嗎?
謝謝!
azure+picgo设置 有配置教程吗
是否可以在 path 配置中形成变量动态 path,例如:
/{year}/{mon}/{day}/{random}-{filename}{.suffix}
这些可以动态获取
可不可以将码云添加上,github存图片还是比较慢。期待。。。
如果我想通过picgo实现删除远程图片或者获取存储空间之类的功能,有实例代码或者插件之类的么。暂时没有看懂插件开发是如何实现的
https://github.com/PicGo/PicGo-Core/blob/dev/src/plugins/transformer/path.ts#L12
可能需要提个PR,或者直接Fork过来修改
📌: Ready to do
🚧: Working in progress
✅: Done
❌: Cancel
TODO | Introduction | Importance | Status |
---|---|---|---|
i18n | i18n support, English first. [v1.5] | ⭐⭐⭐ | 📌 |
Batch upload optimization | Optimize batch upload experience && more useful progress information. [v2.0+] | ⭐⭐⭐ | 📌 |
Plugin process | A single process for running plugins && new async proxy api for plugins. [v2.0] | ⭐⭐⭐ | 📌 |
Plugin install & update optimization | Ability to install specific versions of plugins. [v1.5+] | ⭐⭐⭐ | 📌 |
Plugin execution order | Ability to change the execution order of plugins. [1.5+] | ⭐⭐⭐ | 📌 |
Notification builtin code | For a better "notification" experience. [v1.5+] | ⭐⭐ | 📌 |
Browser support | Refactor code with adapter mode to support web. [v3.0+] | ⭐⭐ | 📌 |
Async event emitter | Change the default sync event-emitter to async. [v1.6] | ⭐⭐ | 📌 |
And more... |
Line 186 in 210956a
PicGo-Core/src/lib/PluginHandler.ts
Line 112 in 210956a
后面这个好像少传了一个 e
到事件参数里面
你好,最近在用picgo接入自己业务的时候发现一个问题,在进度显示上好像有点不友好。就算传入多个文件,仿佛uploadProgress事件也只会返回30 60 100,这样的话不利于判断已上传图片数量和未上传图片数量。所以我是需要生成多个picgo实例完成数量监控么?会影响性能么?
虽然控制台有输出,我现在在用SHAREX截图并调用PICGO上传,因为开机启动的软件太多.所以PIC就用了这个CORE版本,很方便.
如果配合TYPORA使用刚刚好,但有时候在NOTION中用,所以就想直接截图后调用命令上传到图床
目前我是自己弄了个批处理..传递参数进来复制链接地址...
实在是SHAREX不知道怎么上传到GITHUB哈哈...
运行
picgo upload pic1.png pic2.png
输出应该是
[PICGO SUCCESS]
https://xxx.com/pic1.png
https://xxx.com/pic2.png
但可能是一个错误的顺序
[PICGO SUCCESS]
https://xxx.com/pic2.png
https://xxx.com/pic1.png
npm update to picgo 1.4.7
However,
“picgo upload" to uplad the first image at clipboard will crash and then cmd window will automatically close in Win 10, yet I have no idea where to look at log file.
By the way, the image drag&drop function at this GitHub text box is literally much better than the current version of picgo at my computer——
But it is still worthy to try picgo. :)
我想把picgo-core接入到自己的项目中,但是现在提供的钩子里好像无法提供报错信息。
比如我上传的图片路径出错了,picgo可以在命令行里log错误,但是我无法在uploadProgress事件里捕获到错误。
请问是我的用法有问题,还是钩子里确实没有提供错误信息呢
dist目录有变更,依赖的子类型路径变了,导致开发和编译报错。
建议这种breaking change积攒起来单独发大版本
再用github作为图床时:
不想用当前时间戳自动命名,想将原文件名自动处理为MD5再上传,这个是必须要自己开发插件吗?
or 有其他更简单的实现方法?
把lowdb中adapter的serialize, deserialize 分别修改为comment-json的strinify和parse可以更好地处理有注释的json文件
const json = require('comment-json');
const adapter = new FileSync('./data/index.json', {
serialize(obj) {
return json.stringify(obj, null, 2);
},
deserialize: json.parse,
});
我这里在~/.picgo
下新建项目
然后执行
$ npm install ./picgo-plugin-gitee
接着配置config.json
{
"picBed": {
"current": "gitee",
"uploader": "gitee",
"transformer": "gitee"
},
"picgoPlugins": {
"picgo-plugin-gitee": true
},
"picBed.gitee": {
"repo": "blog",
"token": "",
"path": "image",
"branch": "",
"username": "blog"
}
}
然后我执行
$ picgo -d u "/Users/caijinglong/Desktop/Simulator Screen Shot - iPhone XR - 2019-02-07 at 21.17.44.png"
控制台输出这样的日志
$ picgo -d u "/Users/caijinglong/Desktop/Simulator Screen Shot - iPhone XR - 2019-02-07 at 21.17.44.png"
[PicGo INFO]: Before transform
[PicGo INFO]: Transforming...
[PicGo WARN]: Can't find transformer - gitee, swtich to default transformer - path
[PicGo INFO]: Before upload
[PicGo INFO]: Uploading...
[PicGo WARN]: Can't find uploader - smms, swtich to default uploader - smms
[PicGo SUCCESS]:
我应该如何配置才能使用gitee作为uploader使用?
总感觉文档内容并不是线性的,我无法按照顺序完成开发过程
客户端上传至SM.MS 图床失败,简单看了下日志好像是更新升级了API
建议: 要是能用配置对象能实例化picgo就更好了
类似:
const conf = {
"picBed": {
"uploader": "smms"
}
}
const picgo = new PicGo(conf)
感觉这样拓展起来比较方便。
请问 https://picgo.github.io/PicGo-Core-Doc/zh/ 这个网站也是静态托管在github上吗,是什么框架? 想学习下,自己也建个类似的网站,谢谢哈
目前的 -s 或者 --silent 模式太 silent 了,都拿不到上传成功的 URL,而非 silent 模式又有一些其他日志,如果从这里拿上传的 URL,还要解析日志信息,希望可以增加一个新模式,只输出上传成功的 URL,对于多个图片,则一行一个。
这样方便在其他 cli 程序不集成 picgo node模块的情况下,获取到用 picgo 上传的图片 URL。
Since the package request was deprecated, PicGo-Core will replace it with axios which is active and maintained.
The timeline is the following:
request
with axios
, but the API exposed to the outside world is still consistent. You can still use ctx.Request.request
. However, it will be warned with deprecated
. The new api is ctx.request
. And you can still use both the old request options
& the new axios options
for requesting.ctx.request
is OK, though the request
lib will be changed to axios
. And you can't use ctx.Request.request
anymore.picgo.upload(['/dir/01.jpg')
这行代码会把图片 01.jpg上传到 http://xxx/01.jpg
我需要上传到 http://xxx/dir/01.jpg 应该如何做?
我github图床已经有图片了,到时在picgo相册里面没有显示,是本来不支持呢还是我设置的问题
配置好github的path rep token 上传图标报错404 - {"message":"Not Found","documentation_url":"https://developer.github.com/v3/repos/contents/#create-or-update-a-file"}。求解决
您好,
请问下picgo-core是否像picgo那样有自动时间戳命名的配置?如果有的话,json文件中该怎么写呢?看了文档,没有找到
我按文档:
ggbang@DESKTOP-K2EEVD4:~/repo$ picgo -h
Usage: picgo [options] [command]
Options:
-v, --version output the version number
-d, --debug debug mode
-s, --silent silent mode
-c, --config <path> set config path
-p, --proxy <url> set proxy for uploading
-h, --help output usage information
Commands:
install|add [options] <plugins...> install picgo plugin
uninstall|rm <plugins...> uninstall picgo plugin
update <plugins...> update picgo plugin
set|config <module> [name] configure config of picgo modules
upload|u [input...] upload, go go go
use [module] use modules of picgo
init [options] <template> [project] create picgo plugin's development templates
ggbang@DESKTOP-K2EEVD4:~/repo$ picgo init plugin picgo-plugin-test
[PicGo INFO]: Template files are downloading...
[PicGo SUCCESS]: Template files are downloaded!
? Plugin name: test
? Plugin description: test
? author:
? Choose modules you want to develop: (Press <space> to select, <a> to toggle all, <i
> to invert selection)
? Your plugin is just used in CLI? No
? Use TS or JS? ts
? Your plugin has some shortcut for GUI? No
[PicGo SUCCESS]:
Generate template files successfully!
Please cd /home/ggbang/repo/picgo-plugin-test, and then
npm install
# or
yarn
[PicGo SUCCESS]: Done!
ggbang@DESKTOP-K2EEVD4:~/repo$ cd /home/ggbang/repo/picgo-plugin-test
ggbang@DESKTOP-K2EEVD4:~/repo/picgo-plugin-test$ npm install
npm WARN deprecated [email protected]: request has been deprecated, see https://github.com/request/request/issues/3142
npm WARN deprecated [email protected]: this
> [email protected] postinstall /home/ggbang/repo/picgo-plugin-test/node_modules/ejs
> node ./postinstall.js
Thank you for installing EJS: built with the Jake JavaScript build tool (https://jakejs.com/)
npm notice created a lockfile as package-lock.json. You should commit this file.
npm WARN [email protected] No repository field.
added 541 packages from 357 contributors in 14.582s
19 packages are looking for funding
run `npm fund` for details
接着我在src/index.ts
中放入如下代码:
import picgo from 'picgo'
const handle = ctx => {
let output = ctx.output
for (let i in output) {
output[i].imgUrl = 'https://xxxxx.jpg'
}
return ctx
}
export = (ctx: picgo) => {
const register = () => {
ctx.helper.uploader.register('test', { handle })
}
return {
register,
uploader: 'test'
}
}
接着复制文件夹到配置文件所在目录并安装
ggbang@DESKTOP-K2EEVD4:~/repo$ cp -r picgo-plugin-test ~/.picgo/picgo-plugin-test
ggbang@DESKTOP-K2EEVD4:~/.picgo$ npm install ./picgo-plugin-test
npm notice created a lockfile as package-lock.json. You should commit this file.
+ [email protected]
added 1 package in 1.545s
19 packages are looking for funding
run `npm fund` for details
但当我测试时,错误发生了:
ggbang@DESKTOP-K2EEVD4:~/.picgo$ picgo use
[PicGo ERROR]: { Error: Cannot find module '/home/ggbang/.picgo/node_modules/picgo-plugin-test'
at Function.Module._resolveFilename (internal/modules/cjs/loader.js:636:15)
at Function.Module._load (internal/modules/cjs/loader.js:562:25)
at Module.require (internal/modules/cjs/loader.js:692:17)
at require (internal/modules/cjs/helpers.js:25:18)
at PluginLoader.getPlugin (/usr/local/lib/node_modules/picgo/dist/src/lib/PluginLoader.js:93:16)
at PluginLoader.registerPlugin (/usr/local/lib/node_modules/picgo/dist/src/lib/PluginLoader.js:63:22)
at PluginLoader.load (/usr/local/lib/node_modules/picgo/dist/src/lib/PluginLoader.js:54:18)
at PicGo.init (/usr/local/lib/node_modules/picgo/dist/src/core/PicGo.js:73:31)
at new PicGo (/usr/local/lib/node_modules/picgo/dist/src/core/PicGo.js:40:14)
at Object.<anonymous> (/usr/local/lib/node_modules/picgo/bin/picgo:12:15) code: 'MODULE_NOT_FOUND' }
? Use an uploader (Use arrow keys)
❯ smms
tcyun
github
qiniu
imgur
aliyun
upyun
请问我是否搞错了哪一步,谢谢?
picgo command works perfectly in terminal. I can upload images successfully. My environment is OS X.
however, when using in Typora, I can only use command line mode.
picgo upload
return 'can not find picgo command'
/usr/local/bin/picgo
return 'env has no node'
I ask Typora as well, post a message here if someone knows the answer. thanks.
the line "this.pluginIdMap.get(LifecyclePlugins.currentPlugin)?.push(id)" in LifecyclePlugins.ts has a runtime bug:
TypeError: _a.push is not a function
比如想上传某个网页里的一些图片,直接复制图片链接上传,或者自动下载下来再上传,而不用手动下载下来再上传
Would it be possible to output a compiled binary package so that this can be run without installing node
and npm
?
Perhaps make use of pkg to do so?
This would be extremely beneficial for many of us who are using an environment where we can't install global tools but we can run single binaries.
现在编译出来的 dist 包含了 src 目录,这样做的目的是什么呢?是不是因为需要 -v
查看版本号引用 package.json 所以保留了原始的 src 目录结构?
这样做会造成 import 的时候出现这样的语句:
总感觉这样有点奇怪,又有 dist 又有 src,语义上有点歧义。
或者说 vs-picgo 在引用的时候是不是应该直接 import src 文件夹下的内容(import { ImgInfo } from 'picgo/src/utils/interfaces';
)?但是目前 picgo 的 src 目录是 npmignore 掉了的,npm install 之后没有 src 文件夹。
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.