Captcha Not Disply Any Image

Hi All

After i used multiple layouts in my app , then Cpatcha not display any image :(

This my code

Controller :




	public function actions()

	{

		return array(

			// captcha action renders the CAPTCHA image displayed on the contact page

			'captcha'=>array(

				'class'=>'CCaptchaAction',

				'backColor'=>0xFFFFFF,

			),

			// page action renders "static" pages stored under 'protected/views/site/pages'

			// They can be accessed via: index.php?r=site/page&view=FileName

			'page'=>array(

				'class'=>'CViewAction',

			),

		);

	}



model :




public function rules()

{

	return array(

		array('email, password', 'required','message'=>'-- {attribute}  '),

	

 		array('password', 'authenticate'),

        	

  		// verifyCode needs to be entered correctly

	array('verifyCode', 'captcha', 'allowEmpty'=>!CCaptcha::checkRequirements(),'message'=>' {attribute}  Error '),

    	

);


}






...

	<div>

		<?php $this->widget('CCaptcha'); ?>

		<?php echo $form->textField($model,'verifyCode'); ?>

		</div>

...




I tested it on request recorder and it sent and receive requests ?!!

any help please ?

Thanks in advance

Hi samilo

Did you observe any difference between one and multiple layout ? (in your code)

Did you modify the components/controller.php ?

Is appeared the bellow html-code In the position of captcha? (check it with firebug)

<img id="yw0" src="…" alt="">

Hi Kon ,

No i didn’t modify components/controller.php , But also I changed my url by removed index.php

and set

‘showScriptName’=>false,

in config file .

this is source code for Captcha

<img id="yw0" src="/ictproject/site/captcha?v=50e29f8d52a78" alt="" />

check in new browser tab what the url localhost/ictproject/site/captcha?v=50e29f8d52a78 displays.

Result

according to http://scvinodkumar.wordpress.com/2010/03/09/the-image-cannot-be-displayed-because-it-contains-error/

the errors may occurs when there are spaces in header http image, but this almost impossible happens in Yii core!

So, Are you sure the only thing you changed is the ‘showScriptName’=>false ? if you set it true, will the image displayed ?

I changed it to true but not worked , thanks I guess it 's impossible :) to fix it .

So the problem is not the showScriptName,

can you find which is your changes in your multi-layout?

Also compare the single layout and multi-layout issues with firebug and coding.

Let us know what is the problem

Yes , I will check that … I guess my problem related to copy/paste code from another project … So I missed something .

Thanks KonApaz