think-svg-captcha

1.0.4 • Public • Published

think-svg-captcha

Build Status Coverage Status npm

think-svg-captcha is just a wrap of svg-captcha.

Usage

default options

const defaultOptions = {
  size: 4, // size of random string
  ignoreChars: '', // filter out some characters
  noise: 3, // number of noise lines
  color: false, // default grey, true if background option is set
  background: '#ffffff', // background color of the svg image
  width: 150, // width of captcha
  height: 50, // height of captcha
  fontPath: './fonts/Comismsh.ttf', // your font path
  fontSize: 32, // captcha text size
  charPreset: 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789' // random character preset
}

demo

import ThinkSvgCaptcha from 'think-svg-captcha';
let captcha = new ThinkSvgCaptcha(options);

captcha.create(); // returns an object that has the following property: {data: 'svg path data', text: 'captcha text'}
captcha.svgCaptcha(text); // return a svg captcha based on text provided.

You can find more details at svg-captcha !

/think-svg-captcha/

    Package Sidebar

    Install

    npm i think-svg-captcha

    Weekly Downloads

    4

    Version

    1.0.4

    License

    ISC

    Unpacked Size

    27.5 kB

    Total Files

    8

    Last publish

    Collaborators

    • lizheming
    • welefen
    • sijiecai
    • lushijie
    • berwin
    • bezos
    • toxicjohann
    • huangxiaolu