forked from postman/itriton-captcha
📖 更新文档
This commit is contained in:
parent
93e3f4f7f3
commit
7c2559192a
2
index.js
2
index.js
|
@ -14,11 +14,13 @@ const opts = {
|
|||
const create = async function (options) {
|
||||
options = Object.assign({}, opts, options);
|
||||
const { width, height, size, url } = options;
|
||||
|
||||
let image = url;
|
||||
if (isUrl(url)) {
|
||||
const axiosData = await axios({ url, responseType: "arraybuffer" });
|
||||
image = axiosData.data;
|
||||
}
|
||||
|
||||
const baseImage = await sharp(image).resize(width, height).png().toBuffer();
|
||||
const left = randomRangeNum(size, width - size);
|
||||
const top = randomRangeNum(size, height - size);
|
||||
|
|
|
@ -4,7 +4,11 @@
|
|||
"description": "生成滑动验证码拼图图片和背景图片",
|
||||
"main": "index.js",
|
||||
"scripts": {
|
||||
"test": "node test.js"
|
||||
"test": "node test.js",
|
||||
"version patch": "npm version patch",
|
||||
"version minor": "npm version minor",
|
||||
"version major": "npm version major",
|
||||
"publish": "npm publish"
|
||||
},
|
||||
"repository": {
|
||||
"type": "git",
|
||||
|
|
Loading…
Reference in New Issue