动态 Web 校验码图片生成 XVcode
- 授权协议: GPL
- 开发语言: Java
- 操作系统: 跨平台
- 软件首页: https://github.com/botaruibo/xvcode
- 软件文档: https://github.com/botaruibo/xvcode/blob/master/README.md
软件介绍
XVcode,Web 动态验证码图片生成工具,用于生成随机验证码图片及返回验证码。以随机圆圈为干扰背景,增加随机前后景透明度,并提供3种gif动态图。
PngGenerator :
GifGenerator:
Gif2Generator:
Gif3Generator:
该项目用于生成gif图片编码器使用了 gifencoder 项目
快速上手
class Test {
//生成验证码图片到本地磁盘 draw image and save to disk
public void main(String args[]) throws IOException {
String path = ".";//图片存储路径 path for image save
Integer height = 40;//image 高度。 image height. count as pixel
Integer width = 200;//image 宽度。 image width. count as pixel
Integer count = 5; // validation code length.
String validCode = null; //验证码
Generator generator = new PngVCGenerator(width, height, count);
generator.write2out(new FileOutputStream(path + "/1.png")).close();
validCode = generator.text(); //get the validation code as 'String'
System.out.println(validCode);
generator = new GifVCGenerator(width, height, count);// gif
generator.write2out(new FileOutputStream(path + "/1.gif")).close();
validCode = generator.text();
System.out.println(validCode);
generator = new Gif2VCGenerator(width, height, count);// gif
generator.write2out(new FileOutputStream(path + "/2.gif")).close();
validCode = generator.text();
System.out.println(validCode);
generator = new Gif3VCGenerator(width, height, count);// gif
generator.write2out(new FileOutputStream(path + "/3.gif")).close();
validCode = generator.text();
System.out.println(validCode);
}如果要将验证码图片以流的方式传到前端,可以直接使用generator.write2out()方法
Use Under Command(require ${JAVA_HOME} set)
可以使用jar包直接生成本地图片。命令:
java -jar xvcode-1.0-SNAPSHOT-cl
usage :
支持参数如下:
usage: -p dir path for the image, default generate in current dir -h image height, between 50 to 500, default 200 -w image width, between 30 to 300, default 40 -cl validation code length, between 2 to 10, default 5
示例:
java -jar xvcode-1.0-SNAPSHOT-cl -p test/ -h 300 -w 60 -cl 7
Adobe Flex 大师之路
2009-5 / 69.80元
《Adobe Flex大师之路》以Flex 3.0为基础,涵盖了Flex技术的核心内容。《Adobe Flex 大师之路》能够帮助您你学习并掌握使用Flex所需的牢靠和全面的知识基础,告诉您你如何把这些知识将之转化为代码,并在实际项目中变通应用。通过学习《Adobe Flex 大师之路》,您你可以利用Flex来构建企业级应用的表现层、改善应用的用户体验、集成企业端的复杂服务。这本书是为所有希望学习......一起来看看 《Adobe Flex 大师之路》 这本书的介绍吧!
