简单的验证码并制作不同的颜色
我刚刚观看了链接 http://simplecaptcha.sourceforge.net/ ,它提供了一些演示图像显示验证码可以设计为彩色验证码,因此它不仅可以是黑白验证码。但由于某种原因,我找不到任何关于如何控制 SimpleCaptcha 颜色的教程:(如果您知道一些片段或教程,请分享它们。
感谢所有有用的评论:)
I've just watched the link as http://simplecaptcha.sourceforge.net/ and it gives demo of some images showing that captcha can be designed as a colored one so it can be not only black and white one. But for some reason I couldn't find any tutorials of how control SimpleCaptcha colors :( If you know some snippets or tutorials share them please.
All useful comments are appreciated :)
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
您希望哪个部分是彩色的?例如,您可以通过
WordRenderer
控制文本的颜色。有关如何使用Captcha.Builder
的示例,请访问在他们的网站。您可以将如下内容添加到任何这些示例中:DefaultWordRenderer
接受颜色和字体的List
,以便您可以根据请求从多种颜色/字体中随机选择。因此,如果您只提供一种颜色和字体,那么您每次都会得到这些。如果您提供五种颜色和一种字体,那么您每次都会得到相同的字体,但颜色将从您提供的五种颜色中随机选择。上面的示例使用
FlatColorBackgroundProducer
,但还有其他选项,包括GradiatedBackgroundProducer
和SquigglesBackgroundProducer
。Which part do you want to be in color? You can, for example, control the color of the text via a
WordRenderer
. Examples of how to use theirCaptcha.Builder
can be found on their website. You can add things like the following to any of these examples:DefaultWordRenderer
accepts aList
of colors and fonts so that you can pick from several colors/fonts randomly per request. So, if you provide it with only one color and font, then you'll get those every time. If you provide it with five colors and one font, then you'll get the same font every time, but the color will be selected randomly from the five that you provided.The example above uses
FlatColorBackgroundProducer
, but there are other options, includingGradiatedBackgroundProducer
andSquigglesBackgroundProducer
.可能使用类 ColoredEdgesWordRenderer。看看 http://simplecaptcha.sourceforge.net/javadocs/index.html
Probably using Class ColoredEdgesWordRenderer. Take look at http://simplecaptcha.sourceforge.net/javadocs/index.html