9 Star 145 Fork 26

智鲸开源 / itriton-captcha

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
克隆/下载
贡献代码
同步代码
取消
提示: 由于 Git 不支持空文件夾,创建文件夹后会生成空的 .keep 文件
Loading...
README
MIT

ITRITON-CAPTCHA

star fork

itriton-captcha itriton-captcha

介绍

生成滑动验证码拼图图片和背景图片

安装

npm i @itriton/captcha

使用方法

const captcha = require('@itriton/captcha')

// 默认(promise)
captcha.create().then(res=>{
    console.log(res)
})

// 自定义参数(promise)
captcha.create(options).then(res=>{
    console.log(res)
})

// 默认(async/await)
async function captcha(){
   const result = await captcha.create()
}

// 自定义参数(async/await)
async function captcha(){
   const result = await captcha.create(options)
}

参数

属性名 类型 默认值 说明
size Number 30 默认拼图大小
width Number 270 图片宽度(px)
height Number 144 图片高度(px)
url String - 图片路径(支持在线地址)

返回值

属性名 类型 说明
backgroundImage Base64 背景图片
jigsawImage Base64 拼图图片
x Number x轴距离

安装sharp失败的解决方案

切换成淘宝镜像再执行npm install sharp命令

npm config set sharp_binary_host "https://npm.taobao.org/mirrors/sharp"

npm config set sharp_libvips_binary_host "https://npm.taobao.org/mirrors/sharp-libvips"

npm install sharp

效果图

结合 @itriton/uniapp 组件库的 行为验证(captcha)组件的实际效果

其他开源项目

ibaleine-weapp

基于原生小程序框架的小程序商城

star fork

GitHub stars GitHub forks

@itriton/uniapp

@itriton/uniapp,是基于uni-app生态开发的组件库

star fork

GitHub stars GitHub forks

MIT License Copyright (c) 2021 icjs-cc Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

简介

@itriton/captcha用于生成滑动验证码拼图图片和背景图片 展开 收起
取消

发行版

暂无发行版

贡献者

全部

近期动态

加载更多
不能加载更多了
JavaScript
1
https://gitee.com/ibaleine-open-source/itriton-captcha.git
git@gitee.com:ibaleine-open-source/itriton-captcha.git
ibaleine-open-source
itriton-captcha
itriton-captcha
master

搜索帮助