1.2.6 • Published 4 years ago

captcha-image v1.2.6

Weekly downloads
26
License
ISC
Repository
github
Last release
4 years ago

Captcha Image Generator

A simple captcha image generator.

Install

  • npm install captcha-image
  • yarn add captcha-image

Example

Play with sandbox example here: Demo

Options

You can pass following parameters to Captcha instance in order to generate custom Captcha image

AttributesValues
font / String'35px Arial'
align / String'center'
baseline / String'middle
width / Number300
height / Number150
bgColor / String#eee
color / String#222
length / Number / Length of text7

Events

  • createImage() method return HTML element parsed as String

Output

Final outcome looks like this:

<img src="..." data-key="..." />

Demo Usage

React

import Captcha from 'captcha-image';

const captchaImage = new Captcha(
  '35px Arial',
  'center',
  'middle',
  300,
  150,
  '#eee',
  '#111',
  6
).createImage();

function createMarkup(source) {
  return { __html: source };
}

function MyCaptcha() {
  return <div dangerouslySetInnerHTML={createMarkup(captchaImage)} />;
}

function App() {
  return (
    <div className='App'>
      <MyCaptcha />
    </div>
  );
}

export default App;
1.2.6

4 years ago

1.2.5

4 years ago

1.2.4

4 years ago

1.2.3

4 years ago

1.2.2

4 years ago

1.2.1

4 years ago

1.2.0

4 years ago

1.1.0

4 years ago

1.0.0

4 years ago