Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

captcha-image

Package Overview
Dependencies
Maintainers
1
Versions
9
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

captcha-image

A simple captcha image generator.

  • 1.2.4
  • Source
  • npm
  • Socket score

Version published
Maintainers
1
Created
Source

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

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'
).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;

Keywords

FAQs

Package last updated on 20 Jun 2020

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc