开发者社区> 镜像站> NPM> node-gm-captcha
node-gm-captcha
use gm to create chaptcha number and image simply
Last updated 3 years ago by xhmm .
MIT · Repository · Bugs · Original npm · Tarball · package.json
$ cnpm install 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
  2. 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.8                                ...           latest (3 years ago)

9 Versions

  • 1.0.8                                ...           3 years ago
  • 1.0.7                                ...           3 years ago
  • 1.0.6 [deprecated]           ...           3 years ago
  • 1.0.5 [deprecated]           ...           3 years ago
  • 1.0.4 [deprecated]           ...           3 years ago
  • 1.0.3 [deprecated]           ...           3 years ago
  • 1.0.2 [deprecated]           ...           3 years ago
  • 1.0.1 [deprecated]           ...           3 years ago
  • 1.0.0 [deprecated]           ...           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