We help IT Professionals succeed at work.

Why, adjusting the Lyla Captcha xml file does not work?

dawes4000 asked
Medium Priority
Last Modified: 2013-12-24
I have been messing with the xml file to make adjustments on the appearence of the jpeg, but the changes do not make a difference. Height, width, backgroundColor, all do not change anything.
What needs to be done for the adjustments to work
Watch Question

Please post the code in your captcha.xml file.


Something is going on that concerns me. I completely renamed every file in the captcha directory to
OLDcaptcha.xml, OLDcaptchaService.cfc and the form still works, the JPEG is rendering. I closed the browser opened a new one thinking a session was stored, but the problem persists. This explains why my adjustments to the xml file did nothing, it's not being used. Does the CFC create a persistant object on the server?

No persistent objects here. Are you sure you are looking at the files in the right directory? Did you copy files to a new working directory to test with?

Oh, hold on. You might have to refresh the xml file by removing the condition in the Application file, reload the page (which will give you an error that the xml file cannot be found) then put the condition back on.

Like this:

<cfparam name="url.reinit" default="false">
<!--- initalize the captcha with the xml config --->
<!--- cfif not structKeyExists(application,"captcha") or url.reinit --->
      <cfset application.captcha = CreateObject("component","captcha.captchaService").init(configFile="captcha/captcha.xml") />
      <cfset application.captcha.setup() />
<!--- /cfif --->

I commented out two lines of code.


OK, I commented the code out saved the application.cfm page, closed all browsers, then re-opened captcha.cfm.
the error appeared: cannot find "captcha.captchaService", I closed the browser opened application.cfm un-commented necessary code, saved it, then reopened captcha.cfm. The JPEG appears.

If the captchaService object is persisting shouldn't that have cleared it up? Is my server caching the object?
Is there a way to reinit application("captcha")?



I tried breaking the application.captcha and the captchaservice is still working.

<cfparam name="url.reinit" default="false">
<!--- initalize the captcha with the xml config --->
<cfif not structKeyExists(application,"captcha") or url.reinit>
     <cfset application.captcha = ""/>
     <cfset application.captcha.setup() />


<cfdump var="#application#">
I get 12 components.\

Is there a way to flush the application.captcha? is'nt application.cfm dependent on sessions and so when the browser closes the session is cleaned out?

Leave those two lines of code commented out for the time being. There is something else going on here. you will know when you've fixed the new problem when the captcha images shows up but says "Captcha Image Unavailable" or something like that. Once you get there, uncomment those lines and it should work.

BUT, you have a new problem. Commenting out those lines shouldn't have given you a captchaService error. Can you please confirm that captchaService.cfc is in located in the captcha folder (this folder should be on the same level as your Application.cfm).

Those vars will be over written when you refresh the page, I believe. I have never had to reopen a browser to target issues with lyla captcha.


Here is the structure of mywebsite directory:

captcha DIR
     img DIR

img DIR and  captchaServiceConfigBean.cfc ar no longer need correct?

Also, I tried the following:
in application.cfm I have the following
<cfapplication name="mywebsite" clientmanagement="No" sessionmanagement="Yes" setclientcookies="No" sessiontimeout="#CreateTimeSpan(0,4,0,0)#" applicationtimeout="#CreateTimeSpan(2,0,0,0)#">

I set, applicationtimeout="#CreateTimeSpan(2,0,0,0)#" to applicationtimeout="#CreateTimeSpan(0,0,0,0)#"

this nuked the application all together, after I changed span back to (2,0,0,0) nothing has been working.
I think I'm going bad to worse.


Now I get
"Could not find the ColdFusion Component captcha.captchaService."
I have restored my application.cfm back to the original working state but the error above persists now.

Session vars will not affect what you are trying to fix.

Is your Application.cfm on the same level as captcha.cfm?

Rename captchaService.cfm to captchaService.cfc


My mistake
captchaService.cfm is actually captchaService.cfc (typo)


Yes, Application.cfm is on the same level as captcha.cfm


I renamed the service to captchaService01.cfc to test for persistence, the test past.
Now in captchaService01.cfc it is looking for the Bean
"Could not find the ColdFusion Component captchaServiceConfigBean." that is because it is named OLDcaptchaServiceConfigBean.cfc

Where are you calling captchaServiceConfigBean from?


My captchaService.cfc that I downloaded from http://lyla.maestropublishing.com/
calls out the bean.

Then rename your config bean file to something captchaService recognizes (captchaServiceConfigBean.cfc)


Yes, I did that. But from the time I nuked the applicationtimeout I have not been able to get any of the captcha to work. I have restored all files to the original configuration I had when the app was working... except for the xml adjustments. Any how, let roll back time a bit.
and work on this problem:
"Could not find the ColdFusion Component captcha.captchaService."
Line Below throws the error in application.cfm:
<cfset application.captcha = CreateObject("component","captcha.captchaService").init(configFile="captcha/captcha.xml") />

captchaService is located at captcha/captchaService.cfc

I'm not quite sure what is causing this error. As long as captcha/captchaService.cfc exists (and named correctly), CreateObject("component","captcha.captchaService") should find it no problem...


I appreciate your patience here. Ok back to sqaure one. I have retored the original downloaded file to the mywebsite directory, that cleaned things up. Apparently by renaming the file Win OS must have added something to the files after that the ended up 2kb larger than the originals. Needless to say, the files are restored. I don't have the error
"Could not find the ColdFusion Component captcha.captchaService."
any longer, however the JPEG is not apearring. I have provided the source below:

<input type="hidden" name="captchaHash" value="564B007BA6273C149E68A2EAC465F59AFF09FEB0" />
<img src="showCaptcha.cfm?hashReference=564B007BA6273C149E68A2EAC465F59AFF09FEB0" border="0" />

under captcha DIR I have an img DIR and in the captcha DIR the captcha.xml directory path looks like this:
<config name="outputDirectory" value="/img"/>


<config name="outputDirectory" value="captcha/img"/>

Now the JPEG appears and the Turing test is working again. OK...
Back to the adjustments on the captcha.xml... Still not working.
I will not mess until I hear from you. View the contents of captcha.xml below:
<captcha version="1.0">
            <config name="outputDirectory" value="captcha/img"/>
            <config name="outputDirectoryIsRelative" value="true"/>
            <config name="saltType" value="auto"/><!-- auto/defined -->
            <config name="saltValue" value=""/>
            <config name="jpegQuality" value="0.90"/>
            <config name="jpegUseBaseline" value="true"/>
            <config name="useAntiAlias" value="true"/>
            <config name="randStrType" value="alpha"/>
            <config name="randStrLen" value="6"/>
            <config name="width" value="250"/>
            <config name="height" value="75"/>
            <config name="fontsize" value="30"/>
            <config name="leftOffset" value="20"/>
            <config name="shearXRange" value="25"/>
            <config name="shearYRange" value="25"/>
            <config name="fontColor" value="light"/>
            <config name="backgroundColor" value="light"/>
            <config name="useGradientBackground" value="true"/>
            <config name="backgroundColorUseCyclic" value="true"/>
            <config name="useOvals" value="true"/>
            <config name="ovalColor" value="medium"/>
            <config name="ovalUseTransparency" value="true"/>
            <config name="minOvals" value="15"/>
            <config name="maxOvals" value="20"/>
            <config name="useBackgroundLines" value="true"/>
            <config name="backgroundLineColor" value="medium"/>
            <config name="backgroundLineUseTransparency" value="true"/>
            <config name="backgroundMinLines" value="5"/>
            <config name="backgroundMaxLines" value="10"/>
            <config name="useForegroundLines" value="true"/>
            <config name="foregroundlineColor" value="light"/>
            <config name="foregroundLineUseTransparency" value="true"/>
            <config name="foregroundMinLines" value="5"/>
            <config name="foregroundMaxLines" value="10"/>
            <font use="true" name="Arial"/>
            <font use="true" name="Arial Black"/>
            <font use="true" name="Arial Cursiva"/>
            <font use="true" name="Arial Negreta"/>
            <font use="true" name="Arial Negreta cursiva"/>
            <font use="true" name="Comic Sans MS"/>
            <font use="true" name="Comic Sans MS Negreta"/>
            <font use="true" name="Courier New"/>
            <font use="true" name="Courier New Cursiva"/>
            <font use="true" name="Courier New Negreta"/>
            <font use="true" name="Courier New Negreta cursiva"/>
            <font use="true" name="Georgia "/>
            <font use="true" name="Georgia Cursiva"/>
            <font use="true" name="Georgia Negreta"/>
            <font use="true" name="Georgia Negreta cursiva"/>
            <font use="true" name="Impact"/>
            <font use="true" name="Lucida Bright Demibold"/>
            <font use="true" name="Lucida Bright Demibold Italic"/>
            <font use="true" name="Lucida Bright Italic"/>
            <font use="true" name="Lucida Bright Regular"/>
            <font use="true" name="Lucida Console"/>
            <font use="true" name="Lucida Sans Demibold"/>
            <font use="true" name="Lucida Sans Regular"/>
            <font use="true" name="Lucida Sans Typewriter Bold"/>
            <font use="true" name="Lucida Sans Typewriter Regular"/>
            <font use="true" name="Lucida Sans Unicode"/>
            <font use="true" name="Microsoft Sans Serif"/>
            <font use="true" name="Palatino Linotype"/>
            <font use="true" name="Palatino Linotype Cursiva"/>
            <font use="true" name="Palatino Linotype Negreta"/>
            <font use="true" name="Palatino Linotype Negreta cursiva"/>
            <font use="true" name="sansserif"/>
            <font use="true" name="sansserif.bold"/>
            <font use="true" name="sansserif.bolditalic"/>
            <font use="true" name="sansserif.italic"/>
            <font use="true" name="serif"/>
            <font use="true" name="serif.bold"/>
            <font use="true" name="serif.bolditalic"/>
            <font use="true" name="serif.italic"/>
            <font use="true" name="Tahoma"/>
            <font use="true" name="Tahoma Negreta"/>
            <font use="true" name="Times New Roman"/>
            <font use="true" name="Times New Roman cursiva"/>
            <font use="true" name="Times New Roman Negreta"/>
            <font use="true" name="Times New Roman Negreta cursiva"/>      
            <font use="true" name="Trebuchet MS"/>
            <font use="true" name="Trebuchet MS Cursiva"/>
            <font use="true" name="Trebuchet MS Negreta"/>
            <font use="true" name="Trebuchet MS Negreta cursiva "/>
            <font use="true" name="Verdana"/>
            <font use="true" name="Verdana Cursiva"/>
            <font use="true" name="Verdana Negreta"/>
            <font use="true" name="Verdana Negreta cursiva"/>

No, worries, We'll keep hacking at this ;)

First, make sure that you have write permissions on that img folder.

Second, change your output directory line to:
<config name="outputDirectory" value="./captcha/img/"/>

Ok! Now, comment out those two lines in the Application.cfm like I showed above and refresh the page with the image on it.

You should get a graphic, but it should say something like Captcha image not available.

Change only this and let me know what happens to your image!


I have write permissions on that img folder.

Second, I changed output directory line to:
<config name="outputDirectory" value="./captcha/img/"/>

The JPEG works.

I went to the server setting and adjusted the application varibale min and max to 20 secs
and within the application.cfm itself. (0,0,0,20)

The xml file works now!!!!

On to the config of the xml file....
how can I make it so the letters are all caps, I can not tell "I" from "L" when lower case.
and the serif fonts make it difficult for me as well.
It's all here:

Set randStrType to alphaUCase for character all in upper case.

Not the solution you were looking for? Getting a personalized solution is easy.

Ask the Experts

Why are you using an application timeout? All I use is the session timeout...


Is there a way to remove the layacaptcha water mark it appears infront othe letter makes them difficult to read?
Using the documentation I am commenting out all of the serif and italic fonts. Thanks.
I have decreased the y-shear but the letters offset way to much, I want to shrink the height to 32.
Will you help with the shear setting?

application timeout was set up during the original onfiguration of a live site by a person that is no longer here.
I imagine it was a default setting. I am not certain yet why it was configured this way, and I'm hesitant to remove it completely because I'm not sure if an application var is set somewhere.


Giving this a break, forum more tomorow. :)


I think I've got this one nailed now. Thanks for your assistance.
Access more of Experts Exchange with a free account
Thanks for using Experts Exchange.

Create a free account to continue.

Limited access with a free account allows you to:

  • View three pieces of content (articles, solutions, posts, and videos)
  • Ask the experts questions (counted toward content limit)
  • Customize your dashboard and profile

*This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.


Please enter a first name

Please enter a last name

8+ characters (letters, numbers, and a symbol)

By clicking, you agree to the Terms of Use and Privacy Policy.