Java验证码库 iCaptcha
本文导语: iCaptcha 是一个 Java 的验证码库,支持国际化和可定制。 示例代码: //Optional Properties Properties props = new Properties(); props.put("format", "jpg"); props.put("font", "Helvetica"); props.put("fontsize", "28"); props.put("min-width", "180"); props.put("padding-x", "25");...
iCaptcha 是一个 Java 的验证码库,支持国际化和可定制。
示例代码:
//Optional Properties
Properties props = new Properties();
props.put("format", "jpg");
props.put("font", "Helvetica");
props.put("fontsize", "28");
props.put("min-width", "180");
props.put("padding-x", "25");
props.put("padding-y", "25");
OutputStream os = new FileOutputStream("c:/captcha/text.jpg");
FactoryLanguageImpl inst=(FactoryLanguageImpl)Producer.forName("org.smx.captcha.impl.FactoryLanguageImpl");
inst.setLanguageDirectory("C:/captcha/lang");
inst.setLanguage("RU");
inst.setRange(5, 10); //Select words between 5-10 letters
Producer.render(os, inst, props);