ccap

node.js generate captcha using c++ library CImg without install any other lib or software

node-ccap —— node.js generate captcha using c++ library CImg.

You can generate captcha without install any other libraries or software, only do npm install ccap, that's all.

node-ccap support linux and windows.

compile maybe cost you 1 minute,simply wait;

performance

generate captcha picture 697/sec;

Install

npm install ccap

var ccap = require('ccap')

Instantiated

these three ways all will be ok:

var captcha = ccap();

var captcha = ccap(width, height, offset);

var captcha = ccap({

	width:256,//set width,default is 256

	height:60,//set height,default is 60

	offset:40,//set text spacing,default is 40

	quality:100,//set pic quality,default is 50

	generate:function(){//Custom the function to generate captcha text

	     //generate captcha text here

	     return text;//return the captcha text

	}

});

  

API

var captcha = ccap();

var ary = captcha.get();//ary[0] is captcha's text,ary[1] is captcha picture buffer.

var text = ary[0];

var buffer = ary[1];

  

Simple Example

var http = require('http');

var ccap = require('../')();//Instantiated ccap class

http.createServer(function (request, response) {

	if(request.url == '/favicon.ico')return response.end('');//Intercept request favicon.ico

	var ary = ccap.get();

	var txt = ary[0];

	var buf = ary[1];

	response.end(buf);

	console.log(txt);

}).listen(8124);

console.log('Server running at http://127.0.0.1:8124/');

  

授权协议

基于MIT协议发布:

The MIT License

Permission is hereby granted, free of charge, to any person obtaining
a copy of this software and associated documentation files (the
"Software"), to deal in the Software without restriction, including
without limitation the rights to use, copy, modify, merge, publish,
distribute, sublicense, and/or sell copies of the Software, and to
permit persons to whom the Software is furnished to do so, subject to
the following conditions:

The above copyright notice and this permission notice shall be
included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

  

wemall 开源微商城 ,微信商城,商城源码,三级分销,微生鲜,微水果,微外卖,微订餐---专业的o2o系统 wemall地址:http://www.wemallshop.com

代码详情:http://js.koahub.com/home/feature/ccap

KoaHub.JS基于Node.js开发的Koa 生成验证码插件代的更多相关文章

  1. KoaHub平台基于Node.js开发的Koa 连接支付宝插件代码信息详情

    KoaHub平台基于Node.js开发的Koa 链接支付宝插件代码信息详情 easy-alipay alipay payment & notification APIs easy-alipay ...

  2. KoaHub平台基于Node.js开发的Koa的简单包装到请求库的类似接口

    co-request co-request promisify wrapper for request co-request Simple wrapper to the request library ...

  3. KoaHub平台基于Node.js开发的Koa JWT认证插件代码信息详情

    koa-jwt Koa JWT authentication middleware. koa-jwt Koa middleware that validates JSON Web Tokens and ...

  4. KoaHub平台基于Node.js开发的Koa的调试实用程序

    debug small debugging utility debug tiny node.js debugging utility modelled after node core's debugg ...

  5. KoaHub.JS基于Node.js开发的mysql的node.js驱动程序代码

    mysql A node.js driver for mysql. It is written in JavaScript, does not require compiling, and is 10 ...

  6. KoaHub.JS基于Node.js开发的处理和显示日期代码

    moment Parse, validate, manipulate, and display dates      A lightweight JavaScript date library for ...

  7. KoaHub平台基于Node.js开发的Koa的连接MongoDB插件代码详情

    koa-mongo MongoDB middleware for koa, support connection pool. koa-mongo koa-mongo is a mongodb midd ...

  8. KoaHub平台基于Node.js开发的Koa的rewrite and index support插件代码详情

    koa-static-server Static file serving middleware for koa with directory, rewrite and index support k ...

  9. KoaHub平台基于Node.js开发的Koa的get/set session插件代码详情

    koa-session2 Middleware for Koa2 to get/set session use with custom stores such as Redis or mongodb ...

随机推荐

  1. swift中标签的使用

    1,标签的创建 1 2 3 4 5 6 7 8 9 10 import UIKit class ViewController: UIViewController {     override func ...

  2. Sql Server 查询多行并一行

    干货 CREATE TABLE #benefit_code21 (id INT, number nvarchar(MAX), pname ), collegeID INT, applicationda ...

  3. Linux下tomcat的安装与项目部署

    最近在linux下安装了jdk,为了圆我以前的心愿,把tomcat也安装了,顺便部署个项目,也算是小又成就感 废话不说了,直接上过程 一.下载安装对应的jdk,并配置Java环境. 有关jdk的安装请 ...

  4. Java如何判断字符串中包含有全角,半角符号

    首先介绍下全角跟半角之间的区别: 在计算机屏幕上,一个汉字要占两个英文字符的位置,人们把一个英文字符所占的位置称为"半角",相对地把一个汉字所占的位置称为"全角" ...

  5. PHP文本处理之中文汉字字符串转换为数组

    在PHP中我们可以通过str_split 将字符串转换为数组,但是却对中文无效,下面记录一下个人将中文字符串转换为数组的方法. 用到的PHP函数 mb_strlen - 获取字符串的长度 mb_sub ...

  6. css3 3d 与案例分析

    作者:魔洁 聊到3d那我们就先聊聊空间维度,首先一维,比如一条线就是一个一维空间,连点成线在这个空间里这些点只能前进后退,二维空间就是一个平面,这时点不仅可以前进后退还可以左右移动,3维空间也可以说是 ...

  7. 关于hashmap的底层实现

    注:以下内容并非基于最新的jdk版本 q1:hashmap为什么叫hashmap? 答:hashmap基于hashtable(不是hashtable类)实现. q2:hashtable(不是hasht ...

  8. vue自定义日期组件

    vue-datepicker 基于 vuejs 2.x 可自定义主题的日期组件 github Usage 只需要在项目中加入 calendar.vue,就可以使用了. 向组件传入 prop 即可改变 ...

  9. apche基于域名,ip,端口的配置

    基于域名的服务端: 13 iptables -F 14 setenforce 0 15 ifconfig eth0 172.18.43.146 16 yum -y install bind bind- ...

  10. 用jdk在cmd下运行编译java程序

    1.首先通过创建一个txt文档,将java代码写入txt文档中保存 2.将保存好的HelloWorld.txt文档重命名为HelloWorld.java文件. 3.打开windows中的"命 ...