-
-
Notifications
You must be signed in to change notification settings - Fork 8
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: resize oversize images before sending #235
Conversation
PR HealthBuild ✅Detailsesbuild: packages/core/src/index.ts -> packages/core/lib/index.js
esbuild: packages/danbooru/src/index.ts -> packages/danbooru/lib/index.js
esbuild: packages/e621/src/index.ts -> packages/e621/lib/index.js
esbuild: packages/gelbooru/src/index.ts -> packages/gelbooru/lib/index.js
esbuild: packages/konachan/src/index.ts -> packages/konachan/lib/index.js
esbuild: packages/local/src/index.ts -> packages/local/lib/index.js
esbuild: packages/lolibooru/src/index.ts -> packages/lolibooru/lib/index.js
esbuild: packages/lolicon/src/index.ts -> packages/lolicon/lib/index.js
esbuild: packages/moehu/src/index.ts -> packages/moehu/lib/index.js
esbuild: packages/pixiv/src/index.ts -> packages/pixiv/lib/index.js
esbuild: packages/safebooru/src/index.ts -> packages/safebooru/lib/index.js
esbuild: packages/sankaku/src/index.ts -> packages/sankaku/lib/index.js
esbuild: packages/yande/src/index.ts -> packages/yande/lib/index.js Lint ✅DetailsChecking formatting...
All matched files use Prettier code style! |
Thank you very much for your contribution. Here are some issues I noticed:
Some thoughts on potential solutions:
Reference: |
另外,有部分 api 支持返回不同尺寸或大小的图片。如果有,应当优先使用 api 所提供的。 |
原本逻辑应该就是优先使用 api 所提供的大小吧。我只是加了如果超过选择的大小就自动缩放,这是可选的。 但我之前用的时候发现就算选了large,meidum,图片有时候都特别大超过15mb,图源是pixiv,lolicon。 |
现在再看看怎么样 |
jimp存在内存和性能问题,考虑再看看有没有其它可以用的库 有时会出现maxMemoryUsageInMB limit exceeded by at least 10MB.的报错 |
明天试试用canvas能不能实现 |
Use canvas might be a better idea since many users have it installed. Since there are image read / write libraries like |
By the way, you should also add this option into the document, in this case, it would go to the page https://github.com/koishijs/koishi-plugin-booru/blob/main/docs/zh-CN/config.md |
现在应该可以了吧 |
等等,似乎还要优化一下,我看puppeteer的 toBuffer是基于 toDataURL实现的,多了不必要的base64转换 |
应该可以了 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Now it should be good to merge
@Lipraty make a double check please.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
添加自动缩小过大图片功能