From: Ted C. <ne...@ya...> - 2007-03-14 19:51:42
|
Hi, =0A I tried the 5 min tutorial yesterday and it worked great! Howev= er, after I customized the gimpy engine, several things are not working cor= rectly. I'm running it on tomcat 5.5 with jdk1.5. Are these caused by my = configuration errors? Any help is appreciated. =0A=0A1. This is the part t= hat puzzles me the most. =0A I copied all the code from DefaultGimpyEng= ine.buildInitialFactories(), and made 1 line change ...=0A=0Afrom TextPaste= r randomPaster =3D new DecoratedRandomTextPaster(..., new SingleColorGenera= tor(Color.black), ...)=0Ato TextPaster randomPaster =3D new DecoratedRandom= TextPaster(..., new SingleColorGenerator(Color.GREEN), ...)=0A=0AAt the end= I do =0A=0AImageCaptchaFactory factory =3D new GimpyFactory(dictionnaryWor= ds, word2image);=0ADefaultGimpyEngine engine =3D new DefaultGimpyEngine();= =0Aengine.addFactory(factory);=0Areturn new DefaultManageableImageCaptchaSe= rvice(new FastHashMapCaptchaStore(), engine, 180, 100000, 75000);=0A=0A = What I found out was that words on images were shown green 80% of the time,= for the rest 20% or more, it seemed it's not taking my customization and j= ust rendered the default, black. Same happened to any customization I mad= e to the default engine (font change, # of chars in the image, image size, = ...). It always seemed there're certain percentage of times where it didn'= t take my customization, and just renders the pictures in default format.= =0A=0A=0A2. When I do new FileReaderRandomBackgroundGenerator(new Integer(2= 00), new Integer(100), "gimpybackgrounds"), I got the following exception w= hen tomcat starts. That's even after I put the gimpybackgrounds directory = (with jpegs in it) in my jpcatcha-all-1.0-RC3.jar. So in the jar file, a p= ath to a jpg in the directory looks like "gimpybackgrounds/1v.jpg" etc. If= I put the directory directly under my tomcat root it works. But, that's n= ot what I want.=0A=0ACaused by: com.octo.captcha.CaptchaException: All trie= d paths :'C:\Program Files\Apache\Tomcat 5.5\gimpybackgrounds=0AC:\Program = Files\Apache\Tomcat 5.5\.\gimpybackgrounds=0AC:\gimpybackgrounds=0AC:\Progr= am Files\Apache\Tomcat 5.5\file:\C:\Program%20Files\Apache\Tomcat%205.5\web= apps\test\WEB-INF\lib\jcaptcha-all-1.0-RC3.jar!\gimpybackgrounds=0A' is not= a directory or cannot be read=0A at com.octo.captcha.component.imag= e.backgroundgenerator.FileReaderRandomBackgroundGenerator.findDirectory(Fil= eReaderRandomBackgroundGenerator.java:135)=0A...=0A=0A=0A3. In DefaultImage= CaptchaEngine.setFactories(CaptchaFactories[]), there's the following line= =0A=0A if (ImageCaptchaFactory.class.isAssignableFrom(factories[i].get= Class())) {throw expection....}=0A=0A=0AShould it be =0A=0A if (! ...is= Assignable...) {throw exception}=0A?=0A=0A=0AYour help is appreciated!=0A= =0ATed=0A=0A=0A =0A________________________________________________________= ____________________________=0ALooking for earth-friendly autos? =0ABrowse = Top Cars by "Green Rating" at Yahoo! Autos' Green Center.=0Ahttp://autos.ya= hoo.com/green_center/ |