开发者社区> 镜像站> NPM> @xhmm/node_gm_captcha
@xhmm/node_gm_captcha
1. this project is still on working , its functionalities are not finally completed. 2. it now just support number captcha and has many limitations. ## installation 1. install [`Graphics Magick`](http://www.graphicsmagick.org/index.html) and make sure it
Last updated 3 years ago by xhmm .
MIT · Original npm · Tarball · package.json
$ cnpm install @xhmm/node_gm_captcha 
SYNC missed versions from official npm registry.

Pre

  1. this project is still on working , its functionalities are not finally completed.
  2. it now just support number captcha and has many limitations.

installation

  1. install Graphics Magick and make sure it can work on your computer.
  2. npm i node-gm-captcha

usage

let Captcha = require('node-gm-captcha');
Captcha.genPic({type:'num',filename:'./uniqueid.jpg'},(err,data)=>{
    if(err) throw err;
    console.log(data);
})

As the example above , you will get an image named 'uniqueid.jpg' under your project folder. And the data will include some data you need , such as the number , filepath , with these , you can do your business logic.

doc

genPic(param:object , callback:fn):void

  1. param
key type required desc
type string yes it now only can set to 'num'
filename string yes where to store the pic , it should be relative path
fontSize number no the font size
w number no the width of the picture
h number no the height of the picture
  1. callback: function(err , data:metaData){ }

TODO

  • [ ] make the pic more complex from recognizing
  • [ ] support char type capthcha
  • [ ] support mix type(char and number) captcha
  • [ ] add delete method so you can easily delete the pic
  • [ ] expose more customized params and method

Current Tags

  • 1.0.6                                ...           latest (3 years ago)

1 Versions

  • 1.0.6                                ...           3 years ago
Maintainers (1)
Downloads
Today 0
This Week 0
This Month 0
Last Day 0
Last Week 0
Last Month 0
Dependencies (1)
  • gm 1.23.1
Dev Dependencies (6)
Dependents (0)
None