diff --git a/example/web_example.js b/example/web_example.js index 1c953ee..88bf066 100644 --- a/example/web_example.js +++ b/example/web_example.js @@ -7,7 +7,10 @@ var ccap = require('../')({ height:50, offset:30, quality:100, - fontsize:40 + fontsize:40, + text_len: 4, // 长度 + str_ary: ['1','2','3','4','5','6','7','9','A','C','D','E','F','G','H', + 'I','J','K','L','M','N','R','S','T','U','W','X','Y','Z'], // 自定义字符组,去掉一些容易搞错的字符如0 O 8 B等 }); http.createServer(function (request, response) { diff --git a/lib/gen.js b/lib/gen.js index 4b3a2c8..a7e16f5 100644 --- a/lib/gen.js +++ b/lib/gen.js @@ -1,14 +1,12 @@ -var str_ary = ['0','1','2','3','4','5','6','7','8','9','A','B','C','D','E','F','G','H', -'I','J','K','L','M','N','O','P','Q','R','S','T','U','V','W','X','Y','Z']; + //定义随机数组 -var gen_fuc = function(){ - var str_num = 6, - r_num = str_ary.length, +var gen_fuc = function(options){ + var r_num = options.str_ary.length, text = ''; - for(var i=0;i